Ad a task to a request?

jasongblack
Tera Contributor

Is there a way to create an ad hoc task and tie it to the Requested Item (RITM) without it being orphaned?  We would need it to update the workflow of the existing request.

2 REPLIES 2

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @jasongblack 

 

1st point, it is not recommended to create as task in RITM outside workflow/ flow.

If you want give a try 

 

LearnNGrowAtul_0-1707063038395.png

 

LearnNGrowAtul_1-1707063051255.png

 

 

Logically you need to update the workflow.

*************************************************************************************************************
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]

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

Amit Verma
Kilo Patron
Kilo Patron

Hi @jasongblack 

 

You can do it via UI as suggested by @Dr Atul G- LNG , Scripting and with Flow Designer as well.  To create a task via script and link it to the RITM and REQ, use below code :

 

var ritmNumber = 'Enter the RITM number';
var ritm = new GlideRecord('sc_req_item');
	ritm.addQuery('number','ritmNumber');
	ritm.query();
	if(ritm.next()){
		var gr = new GlideRecord('sc_task');
		gr.request_item = ritm.getUniqueValue();
		gr.request = ritm.request;
		gr.initialize();
		var taskId = gr.insert();

 

For creating it via flow, use Create Catalog Task action https://docs.servicenow.com/bundle/vancouver-build-workflows/page/administer/flow-designer/reference...

 

Thanks & Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.