How to create multiple catalog tasks for single RITM using workflow/Flow designer?

Siva P
Tera Expert

How to create multiple catalog tasks for single RITM using workflow/Flow designer?

1 ACCEPTED SOLUTION

Community Alums
Not applicable

Hi @sambasiva ,

This video is what you all need to configure: https://www.youtube.com/watch?v=xOc342NUzI8

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

View solution in original post

8 REPLIES 8

Thank you its working for catalog task creation. But the record is not creating in my custom table and also Can you suggest me how i can set the value in field which should take from the request item variable.

find_real_file.png

Hi sambasiva,

Can you please Go to the flow properties and change to the system user. Also to set the value field from variable please include an action Get catalog variables and select your item in that action and use those variables to set the value in field.

Please mark correct if helpful

Thanks

Mohit

Hi Mohit,

i have done changes as you suggested. but no luck.

find_real_file.png

 

Can answers get as worthless as this one? Please put effort if you are to participate on the forums. Here is a real answer:

 

Using workflow there is no way using the out-of-the-box workflow activities to achieve what you want. Instead you will need to write a script. A common requirement is to create a catalog task for each MRVS entry. Therefore when you loop through the MRVS JSON array, your script will look like this while in a workflow on the sc_req_item table:

(function() {
	var task = new GlideRecord("sc_task");
	task.request_item = current.sys_id;
	task.parent = current.sys_id;
	task.short_description = "MRVS Task 1";
	task.description = "Please do the following:\n";
	task.assignment_group = "";
	task.assigned_to = "";
	// set other fields that you require
	task.insert();
})();

Then you'll probably want a wait-for-condition activity for all tasks to complete, that script will look like

answer = (function() {
	var ctask = new GlideRecord('sc_task');
	ctask.addQuery('request_item', current.sys_id + '');
	ctask.addQuery('state', 'NOT IN', '3,7'); // Closed Complete, Closed Cancelled, etc
	ctask.query();
	
	return !ctask.hasNext();
})();