Flow Designer for Service Catalog

Ben42
Tera Contributor

Hi All,

I am new to flow designer, I would like to know,

how do we trigger flow designer when a request is submitted from catalog item and

how to map fields from variables to fields on the RITM form and

How to bring all variables of catalog item that is submitted to Variables editor on RITM form ?

 

Thanks,

Ben

 

 

1 ACCEPTED SOLUTION

DScroggins
Kilo Sage

Hi Ben,

Once you activate the Flow Designer / Service Catalog Plugin you will have a new trigger option for Service Catalog:

find_real_file.png

 

After you create and save the flow with "Service Catalog" trigger you can then head to your Catalog Item and add the "Flow" field to the form. Make sure there are no values in the "Workflow" or "Execution Plan" fields then select your newly created flow in the "Flow" field:

find_real_file.png

Once you are back in your Flow you can add the action "Get Catalog Variables" and configure it to select your catalog item. Once your catalog item is selected in the "Template Catalog Item" you can then select the catalog variables to utilize in the flow like so:

find_real_file.png

 

After which the variables will be available in the "Data" section of the flow:

find_real_file.png

 

When the catalog item is submitted by an end user the variables will automatically be associated to the RITM and will show in the variable editor.

 

Hope this helps.

 

--David

View solution in original post

23 REPLIES 23

Happy to help. The catalog variables should automatically transfer over to the RITM due to normal OOB background process whether you utilize a workflow, a flow, or an execution plan. So you should not have to configure anything else. If you are going to utilize the 1 flow to many catalog items then you wouldnt be able to map the individual variables into the flow using the "Get Catalog Variables" action as each item can and most likely will have different variables. You can however still configure multiple catalog items to trigger a single flow by identifying the flow on the catalog item itself. 

The all mainly depends on what you are configuring the flow to do with regards to the catalog item submissions i.e simple approvals, task creations, etc.

 

Hi Ben,

For your service catalog to use one workflow for all catalog items, do you just assign the RITM to the respective catalog item's fulfillment group?

We can do that for some, but it wouldn't account for requests that have 1+ approval or 2+ tasks in the workflow. How do you handle multi-step/task processes from the catalog? Or do you require all your catalog items to have just one task with no variation?

Ben, 

I had this scenario come up today. Needed the Flow to dynamically populate the Task Variable Editor depending on a given RITM. (to be able to apply a generic Flow to multiple catalog items)

 

https://community.servicenow.com/community?id=community_question&sys_id=9c01cba5db98dbc01dcaf3231f96...

 

Checkout the script in the link

//varName = variable from the ritm you want displayed on the task

// you can loop over ritm.variables to access the names

	var itemOption = new GlideRecord("sc_item_option_mtom");
	itemOption.addQuery("request_item", ritmID);
	itemOption.addQuery("sc_item_option.item_option_new.name", varName);
	itemOption.query();

	while (itemOption.next()) {
		var myTaskVar = new GlideRecord("sc_item_variables_task");
		myTaskVar.initialize();
		myTaskVar.task = taskID;
		myTaskVar.variable = itemOption.sc_item_option.item_option_new;
		myTaskVar.insert();
	}

 

I'm a bit confused where you're specifying this script and what your final script actually is.

For example, you commented our varName, but then it's in your code. You have ritmID as a parameter, but I don't see where it's defined. 

Would you be willing to tell me where you actually put this script and provide the full script? I have the exact same situation and am trying to populate the variable task editor on the actual tasks so I can use one flow for a whole bunch of catalog items.

Thanks!

The script is in a custom Action in Flow Designer

replace "varName" with the name of the RITM variable you want to show on the Task

ritmID is just a placeholder where you'd put your actual ritm.sysID

In this case, we can pass the current record ID as an Input into the Flow Action

Here's the code from the instance:

// loop over and add ritm variables
// looks up the sc_item_option_mtom based off a ritm variable
// inserts record to the sc_item_variables_task table 

for (item in inputs.requested_item.variables) {

     var itemOption = new GlideRecord("sc_item_option_mtom");
         itemOption.addQuery("request_item", inputs.requested_item);
         itemOption.addQuery("sc_item_option.item_option_new.name", item);
         itemOption.query();

     while (itemOption.next()) {        
          var myTaskVar = new GlideRecord("sc_item_variables_task");
              myTaskVar.initialize();
              myTaskVar.task = taskID;
              myTaskVar.variable = itemOption.sc_item_option.item_option_new;
              myTaskVar.insert();
     }
}