Skip to main content

Update Ticket Activity

Overview​

You can use the Update Ticket (update_ticket) activity in Pia package editor to update the properties of a ticket in your ticketing system. This activity gives you the ability to update ticket values based on the outcome of the tasks performed by Pia as a part of the current Package execution.

An example scenario where this activity may be used is to change the ticket status from 'New' to 'In Progress' automatically when Pia starts package execution for the ticket.

The Update Ticket activity can be located by searching for "Update Ticket" in the list of activities in the package editor:

Below is the code snippet that shows how you can use the Update Ticket activity to modify values of a Ticket:

# Pia Automation Package
conditions:
- name: 'client_filter'
optMode: 'OptOut'
category: 'Hello World'

- name: 'chat'
option_button: 'Update Ticket Values'
option_text: 'This is a test package.'
option_category: 'Test Category'

steps:
- task: update_ticket
inputs:
ticket_id: '4685'
summary: 'Updated Summary using the Update Ticket Activity'

Activity Behaviour​

The primary purpose of the Update Ticket activity is to update values of different fields within the ticket during package execution so that the engineer does not have to manually change those field values.

One requirement for this activity to work properly is that you will need to have a connected service configured for the ticketing system used by your company. To learn more on setting up connected services, refer to this article.

The Update Ticket Activity can be used in all package executions (i.e. packages that are initiated via Schedule or Ticketing System Event or the Chatbot).

Input Properties​

Use properties to modify the behaviour of the activity.

Property Name: ticket_id
Property Required: Yes
Property Description: This is the Ticketing System Id of the ticket that needs to be updated.

Property Name: summary
Property Required: No
Property Description: Summary defined here will be added to the ticket as the Ticket Summary/ Ticket Title

Property Name: board_id
Property Required: No
Property Description: This is the board Id to which the ticket belongs.

Property Name: type_id
Property Required: No
Property Description: Enter the Ticket Type Id in the ticketing system that needs to be assigned to the ticket.

Property Name: subtype_id
Property Required: No
Property Description: Enter the Ticket Subtype Id in the ticketing system that needs to be assigned to the ticket.

Property Name: item_id
Property Required: No
Property Description: Enter the Ticket Item Id in the ticketing system that needs to be assigned to the ticket.

Property Name: contact_id
Property Required: No
Property Description: Enter the Contact Id for the contact available in the ticketing system that needs to be assigned to the ticket.

Property Name: owner_id
Property Required: No
Property Description: Enter the owner Id of the Owner available in the ticketing system that needs to be assigned to the ticket.

Property Name: company_id
Property Required: No
Property Description: Enter the Company Id of the Company available in the ticketing system that needs to be assigned to the ticket.

Property Name: priority_id
Property Required: No
Property Description: Enter the Ticket Priority Id that needs to be assigned to the ticket.

Property Name: status_id
Property Required: No
Property Description: Enter the Ticket Status Id that needs to be assigned to the ticket.

Property Name: source_id
Property Required: No
Property Description: Enter the Ticket Source Id that needs to be assigned to the ticket.

Output Properties​

This activity does not have any output property.

Examples​

Here is an example package that updates Ticket values after a package execution is complete.

# Pia Automation Package
conditions:
- name: 'client_filter'
optMode: 'OptOut'
category: 'Hello World'

- name: 'chat'
option_button: 'update ticket'
option_text: 'Text which is displayed in the Pia Chatbot'
option_category: 'Pia Chatbot Category'

steps:
- task: chat_interaction
alias: 'update_ticket_summary'
inputs:
text: 'Enter your name:'
form_name: 'user_name'

- task: inline_powershell
alias: 'summary_builder'
inputs:
ticket_owner: =chat_interaction.form.ticket_summary_name
script: |
$newSummary = "Test ticket for $ticket_owner"
return @{newSummary = $newSummary}


- task: update_ticket
inputs:
ticket_id: $Ctx_Ticket_Id
summary: =summary_builder.newSummary

A form has been used in the above package with following properties:

Here, the ticket summary is updated based on the name provided by the user.