How to use pipeline action: Evaluate JavaScript for accessing JIRA Tickets?
Overview
In pipeline action - Evaluate JavaScript following methods are available to access JIRA ticketing API calls
Script Method - getJIRATickets('seekerEmailAddress')
To get list of tickets, script call will appear as follows:
//Get tickets
var tickets = getJIRATickets("${Guest.Email}");
In response method will return list of tickets JSON
[
{
"Seeker": "0007002",
"Agent": "0007003",
"Question": "Employee payroll application server is down.",
"ChatTranscript": "",
"Id": "f12ca184735123002728660c4cf6a7ef",
"Number": "0007001",
"URL": "https://dev82149.jira.com/prj-0007001",
"UpdatedOn": "2023-06-07 12:24:46",
"TicketState": "New"
},
{
"Seeker": "0007002",
"Agent": "0007003",
"Question": "Performance problems with wifi",
"ChatTranscript": "",
"Id": "78271e1347c12200e0ef563dbb9a7109",
"Number": "0000057",
"URL": "https://dev82149.jira.com/prj-0000057",
"UpdatedOn": "2023-05-29 13:20:52",
"TicketState": "New"
}
]
JSON response can be converted into an array
var ticketsArray = JSON.parse(tickets);
//Array allows you to get count and loop through ticket records etc...
sendReply("Count of tickets: " + ticketsArray.length);
Script Method - createJIRATicket(seekerEmailAddress, agentEmailAddress, title, description, project)
To create a ticket, in script create a ticket object as follows:
//Make API call to create ticket
var result = createJIRATicket('seeker@domain','agent@domain','incident title','incident description','project');
createJIRATicket call will return JSON response
{
"Seeker": "id",
"Agent": "id",
"Question": "session question",
"ChatTranscript": "",
"Id": "8a0890212f572510ee31f64ef699b69d",
"Number": "INC0010004",
"URL": "https://dev.jira.com/PRJ-XXXX"
}
Script Methods
updateJIRATicketTitle(ticketId, updatedTitle)
updateJIRATicketDescription(ticketId, updatedDescription)
assignJIRATicket(ticketId, agentEmailAddress)
JavaScript JIRA helper calls allow updating of ticket title, description and assigning ticket to an advisor.
//API call to update title
var result = updateJIRATicketTitle('00070', 'WiFi issue at NYC hub');
//API call to update description
var result = updateJIRATicketDescription('00070', 'Please engage network team');
//API call to assign ticket
var result = assignJIRATicket('00070', 'agent@domain');
API call will return boolean status True (success) or False (failure)
Related Items
To further enhance your understanding and utilization of the ticketing integration in Chime, here are some related resources:
- Streamline Service Desk Support Operations with JIRA Ticketing Integration
- Create JIRA Ticket
- List JIRA tickets
API,
pipeline,
javascript,
tickets,
incidents,
Ticketing,
JIRA
vgarg