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

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @AbdurRahmanSnow 

 

May i know why there are double work for same person? what is use case? 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi Sir. Actually, the workflow is configured in such a way that, once this REQTASK get closed, one more RITM from a different Catalog Form will get created.
This is the requirement from customer.

Hi @AbdurRahmanSnow 

 

That is the process, but why should the same person who is closing the task also approve the RITM? If the user is closing the task, it means they know what they are doing. Setting them up again as an approver creates redundant work for them.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Yeah correct Sir, but this is what the customer is asking. Even I don't know...

Try to see what value it brings.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************