Auto update of state from Pending to Inprogress when user inputs are given

gayathri34
Kilo Contributor

Auto update of state from Pending to Inprogress when user inputs are given

As a user,

I would like my request state to change from 'Pending' with reason 'awaiting caller' to 'Inprogress' when I add a comment
so that fulfiller can continue to work on request there after

I got this question and I created script as below.

gs.include('validators');

if (current.getTableName() == "sc_task") {
current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
current.state = 2;
if (gs.hasRole("itil")) {
if (email.body.assign != undefined)
current.assigned_to = email.body.assign;

if (email.body.priority != undefined && isNumeric(email.body.priority))
current.priority = email.body.priority;
}

current.update();
}

 

please help me with the solutions.

10 REPLIES 10

Hi Gayathri,

Yes, you will have to write inbound action.

In email inbound, when to run condition you can write something like subject contains and body contains as shown below, this subject or body value should be unique value from your above shown email with which you can make sure that you are not executing this for other email. 

find_real_file.png

In action tab you can write script something like below to change state,

find_real_file.png

I have written above on incident table, looks like you want it on requested item table so change accordingly.

Please mark this as Correct or Helpful if it helps.

Thanks and Regards,
Abhijit

By marking my response as correct or helpful, you contribute to helping future readers with similar issues.
Regards,
Abhijit
ServiceNow MVP