Inbound Email Script to Close RITM

kamchow
Giga Contributor

An email sent out to "Requestor" to reply either "accept" or "reject" when catalog task is closed. This email is triggered from "sc_task" table. Can someone share how to use Inbound Email Action to close RITM if "accept" is replied?

We'd created an Inbound Action on "sc_req_item" table, but didn't work:

find_real_file.png

find_real_file.png

Error message:

Skipping 'Mark Request Item Closed', email is a reply, and the record it matches is not in the Inbound Email Action's table.

1 ACCEPTED SOLUTION

Geoffrey2
ServiceNow Employee
ServiceNow Employee

If the Email Notification is being sent from the sc_task, then the Inbound Action will need to be on the sc_task table too.


If you want it to close the sc_req_item, then you will need to do so with a script on the Action tab:



var ritm = new GlideRecord('sc_req_item');


if (ritm.get(current.request_item)) {


      ritm.state = 3; // Closed Complete


      ritm.work_notes = 'Service Request Accept';


      ritm.update();


}


View solution in original post

9 REPLIES 9

We're using 'state'



find_real_file.png


Geoffrey2
ServiceNow Employee
ServiceNow Employee

Then the value will be a number, not "Rework".   Click Show Choice List to find the value for the Rework label.


I changed it to 8 and it worked... Again, much thanks for help.


Error:



Skipping 'Update Catalog Request to Rework', did not create or update sc_task


tony_barratt
ServiceNow Employee
ServiceNow Employee

Hi KamSuen,



Is the inbound action defining on sc_task? From the skipping message it seems likely.


Did your target record actually get modified by gliding rather than a current.update();?


If so the inbound action may be described as "Skipping"



Best Regards



Tony