Get Ticket Data Activity
Overviewβ
The Get Ticket Data (get_ticket_data) Activity is a built in activity available in Pia that you can use in your automations to retrieve ticket data. This activity allows you to access detailed data for a specified ticket that can be further used in the automation to perform multiple set of tasks.
An example scenario where this activity is currently used in Pia is in the Triage v2 Automation. The automation uses the Get Ticket Data Activity to retrieve ticket details so that the tickets are stamped and dispatched correctly based on the available details.
The Get Ticket Data activity can be located by searching for "Get Ticket Data" in the list of activities in the package editor:
Here is a working sample of the activity in a basic package:
# Pia Automation Package
conditions:
- name: 'client_filter'
optMode: 'OptOut'
category: 'Hello World'
- name: 'chat'
option_button: 'Get Ticket Activity'
option_text: 'Text which is displayed in the Pia Chatbot'
option_category: 'Pia Chatbot Category'
steps:
- task: get_ticket_data
inputs:
ticket_id: '17661'
retrieve_ticket_body: 'true'
- task: inline_powershell
inputs:
ticket: =get_ticket_data.ticket
script: |
$parsedTicket = $(ConvertFrom-Json $ticket)
$ticketBody = $parsedTicket.summary
$boardId = $($parsedTicket.board.id)
$chatText = "Current ticket summary: $ticketBody
Board id: $boardId"
return @{chatText = $chatText}
- task: chat_interaction
inputs:
text: =inline_powershell.chatText
In the above example, the package retrieves the ticket summary and Board ID of a ticket from your PSA and displays in the Pia Chatbot as below:
Activity Behaviourβ
The Get Ticket Data activity is primarily used to retrieve all the information of the specified ticket from your ticketing system. You can filter the data being retrieved by using the unique key assigned to each data and filter expressions as input properties to this activity.
For this activity to run successfully, you must have a ticketing system connected service configured in your Pia tenant. To learn more about connected services, click here.
The Get Ticket Data Activity can be used in all types of package executions. This includes packages which have been initiated via the Pia Chatbot or via Ticketing System Event.
Input Propertiesβ
Use properties to modify the behaviour of the activity.
Property Name: ticket_id
Property Required: Yes
Property Description: Provide the ticket id that you need to get data for. If the ticket id is not provided, the package will retrieve the details for the current ticket that is used in the Chatbot.
Property Name: retrieve_ticket_body
Property Required: No
Property Options: true or false
Default Option: false
Property Description: If this is true, ticket body will be included in the data that is retrieved by the activity.
Property Name: retrieve_ticket_contact
Property Required: No
Property Options: true or false
Default Option: false
Property Description: If this is true, ticket contact will be included in the data that is retrieved by the activity.
Property Name: retrieve_ticket_company
Property Required: No
Property Options: true or false
Default Option: false
Property Description: If this is true, ticket company will be included in the data that is retrieved by the activity.
Output Propertiesβ
These is a single property that the Get Ticket activity makes available:
Property Name: ticket
Property Description: This is the json object returned by the activity including all the ticket information.
Here is a sample of the Json object returned by the activity.
{
"displayId": "17661",
"id": "17661",
"summary": "Test Ticket for Get Ticket Data Activity",
"board": {
"id": "1",
"name": "Help Desk"
},
"type": {
"id": "192",
"name": "MUST CHANGE"
},
"subType": null,
"item": null,
"contact": null,
"owner": null,
"company": null,
"closedFlag": false,
"priority": {
"id": "8",
"name": "Priority 3 - Medium"
},
"customFields": [
{
"id": null,
"caption": "CustomProp",
"value": null
},
{
"id": null,
"caption": "CustomPropCheckBox",
"value": "false"
},
{
"id": null,
"caption": "CompanyCustomProp",
"value": "false"
},
{
"id": null,
"caption": "Pia Serviceable",
"value": null
},
{
"id": null,
"caption": "Test",
"value": null
},
{
"id": null,
"caption": "Test2",
"value": null
},
{
"id": null,
"caption": "POD",
"value": null
}
],
"status": {
"id": "16",
"name": "New"
},
"closedDate": null,
"parentTicketId": null,
"_info": {
"updatedBy": "pia.dev2",
"lastUpdated": "2025-02-27T23:56:36Z",
"enteredBy": "pia.dev2",
"dateEntered": "2025-02-27T23:34:19Z"
},
"source": {
"id": "3",
"name": "Internal"
},
"FieldInfo": null
}