Change field values based on conditons

Hi guys,

In fresh service While created new ticket i have few conditions those are
For Example:

  1. if anyone is giving priority has medium then automatically it should change department value to Development
  2. if anyone is giving priority has high then automatically change department value to Customer support.

How to change filed values based on other input values.

can anyone help me How to write a logic for this on app.js

Thanks in Advance!

Hi, @Nani_rishi!

If I understand correctly, you are looking for the Events Methods, specifically the: ticket.priorityChanged.
You can listen to this event, and based on the new value, call the Interface Method: Set Value for Ticket Property Fields.

Example:

client.interface.trigger(“setValue”, {id: “department”, value: 1})

3 Likes

While using client.interface.trigger(“setValue”, {id: “department”, value: 1}) Now i can able to change the values based on conditions but for urgency and impact facing an issue. Values are getting but its not setting to the field.
Example :if status is open then urgency should change to high in new ticket page.—not working
if i give condition like urgency is medium and priority should change to medium this is working

In service documentation for interfaces i am not able to find any syntax about trigger urgency and impact.

Indeed, it seems that for urgency and impact it is not possible to set using interface set value method.
Perhaps you could accomplish what you want setting the values using API call: Update a Ticket.
You could call it when: ticket.propertiesUpdated or Serverless OnTicketUpdate.

1 Like

Apart from writing code to update field values, you can also setup a workflow automator from admin, which can help you in achieving this task.

2 Likes