How to convert Workflow into Flow designer for MRVS

Rohan04
Tera Contributor

I am having a workflow for to create multiple RITM from single request based on MRVS. I am here pasting the procedure which I followed. But, I am having a requirement of to do it by using flow designer

 

Creating the Requested Items

Now, there are probably a dozen ways to do this, but I chose to do this via the workflow.  When the off-boarding catalog item is submitted, it kicks off a workflow identified on the item record like all "normal" requests.  The key to this workflow is what it does once it kicks off

Rohan04_0-1718867947030.png

 

As you can see, the workflow is quite small and only contains a few activities:

Begin:  you cant start without a beginning

Run Script (Set Parent RITM Value):  this updates the RITM record that is created when the user initially submits the record.  You can add anything you want to this activity as it doesn't really matter what is added to this record as you will see later.

Run Script (Create Multi Row RITMS):  This is where the magic happens.  This Run Script is what creates each RITM according to the rows on the multi row variable set.  The script used:

//get  row count for each MRVS row
var rowCount = current.variables.offboarding_user_list.getRowCount(); //This includes the internal name of the multi row variable set which is "offboarding_user_list"
for (var i = 0; i < rowCount; i++) {

	//Define variables that will be the same on each RITM.  Add more as required
	var req = current.request;
	var reqBy = current.variables.requested_by;
	
	//Grab each row of variables that will be different on each RITM
	var row = current.variables.offboarding_user_list.getRow(i);
	var user = row.user;
	var nam = row.full_name;
	var num = row.employee_number;
	var mgr = row.manager;
	
	//Crete a RITM for each row
	var rec = new GlideRecord ('sc_req_item');
	rec.cat_item = 'f06761511b582010e8addd3bdc4bcbfe';//catalog item for offboarding line item  NOTE:  This is REQUIRED to kick off the individual workflow created by each MRVS line item
	rec.request = req;
	rec.request.requested_for = reqBy;
	rec.approval = 'approved';
	rec.state = 1;
	rec.stage = 'request_approved';
	rec.assignment_group = 'ea42046613059200a01f3ea32244b0a0'; //sys_id of the Human Resources group
	rec.short_description = "Off-boarding for user "+nam;
	rec.description = "Off-board this user: \n - Name: "+nam+"\n - Employee Number: "+num+"\n - Manager: "+mgr;

	rec.insert();
}

An important part of this workflow activity is the fact that I identified a catalog item when creating the MRVS request items.  This will allow each of the RITMs created to kick off their own workflow individually.  It is THAT workflow that will create any tasks, approvals, notifications, etc... for each given Request Item.

Timer (wait 5 seconds):  To let it all run and stuff

Run Script (Set Value and Delete):  This activity simply deletes the "parent" request item since it is pretty useless after all.  We only needed it to trigger a workflow that created the other RITM records.  That bit of script:

current.deleteRecord();

I want to do this by using flow designer...

 

Your response will be Appreciated!!!

0 REPLIES 0