How to make the same person as Approver on RITM, who closes the REQTASK in Workflow script?

AbdurRahmanSnow
Giga Guru

Good morning.
On a Catalog Form, I have a Workflow. The requirement is on RITM, whenever the person closes the REQTASK, the same person should be added the Approver on RITM.
How can we do this? Through User Approval - Run script? (Screenshot below). Instead of Group approval, I want the same person who closes the REQTASK to be the approver on RITM, so that, once he approves, the next stages in Workflow proceed.

AbdurRahmanSnow_0-1740374818963.png

 

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@AbdurRahmanSnow 

you can use user approval activity and use script

answer = [];
var req = new GlideRecord('sc_task');
req.orderByDesc('sys_created_on');
req.addQuery('active', 'false');
req.addQuery('request_item', current.sys_id);
req.setLimit(1);
req.query();
if (req.next()) {
    answer.push(req.closed_by.toString());
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

10 REPLIES 10

Ankur Bawiskar
Tera Patron
Tera Patron

@AbdurRahmanSnow 

you can use user approval activity and use script

answer = [];
var req = new GlideRecord('sc_task');
req.orderByDesc('sys_created_on');
req.addQuery('active', 'false');
req.addQuery('request_item', current.sys_id);
req.setLimit(1);
req.query();
if (req.next()) {
    answer.push(req.closed_by.toString());
}

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Sure Ankur. I will try out and will let you know. Thanks a lot.

@AbdurRahmanSnow 

Thank you for marking my response as helpful.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thanks a lot Ankur. It worked. Really appreciate.