How to use pipeline action: Evaluate JavaScript for accessing Cherwell Tickets?

Overview

In pipeline action - Evaluate JavaScript following methods are available to access Cherwell ticketing API calls

Script Method - getCherwellTickets('seekerEmailAddress')

To get list of tickets, script call will appear as follows:

//Get tickets
var tickets = getCherwellTickets("${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.cherwell.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.cherwell.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 Methods

updateCherwellTicketDescription(ticketNumber, updatedDescription)

assignCherwellTicket(ticketNumber, agentEmailAddress)

JavaScript Cherwell helper calls allow updating of ticket description and assigning ticket to an advisor.

//API call to update description
var result = updateCherwellTicketDescription('00070', 'Please engage network team');

//API call to assign ticket
var result = assignCherwellTicket('00070', 'agent@domain');

API call will return updated ticket record.

Related Items

To further enhance your understanding and utilization of the ticketing integration in Chime, here are some related resources:

API, pipeline, javascript, tickets, incidents, Ticketing, cherwell
vgarg