How to create Approval Sub Flow with a script in Flow Designer?

gjz
Mega Sage

I'm trying to convert my Workflows to Flow Designer and I want to use Sub Flows for repeatable actions.

In most of our Service Catalog workflows, we require departmental approval before we fulfill the request.  Since the approval is based on who requested the item and what department they are in, we have added a script to the workflow approval step.  I cannot figure out how to do that in Flow Designer and would like some help.

Our Workflow approval step looks like this:

find_real_file.png

How do I translate the above into this?  I don't see how I can add the approval group and the script with Flow Designer.  And I do want it to be a sub flow so I don't need to add the same steps to multiple flows.

find_real_file.png

7 REPLIES 7

Community Alums
Not applicable

Hi @gjz ,

you can trigger flow from workflow run script

Refer below link for help

Scripting with Flows, Subflows, and Actions

// Map inputs. For a flow with a record trigger, inputs are the record and table
	var inputs = {};
	inputs['current'] = current; // GlideRecord of table:  
	inputs['table_name'] = 'incident';

   // Execute the global flow called test_flow 
   sn_fd.FlowAPI.executeFlow('global.test_flow', inputs);

 

Learn more about subflows: 

https://docs.servicenow.com/bundle/sandiego-servicenow-platform/page/administer/flow-designer/task/create-subflow.html

 

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Sandeep,

Thanks for the answer but I am still unsure what I need to do and would appreciate more help.  I have done the exercises from the link you provided, thanks for providing it, it was very helpful.

How would you create a repeatable action/flow/subflow with this business requirements?

More than one person in a department can approve a catalog item if they have the custom approver role.  The approver may only approve RITMs that are associated to their department.

Most catalog items require departmental approval.

 

Linda S
ServiceNow Employee
ServiceNow Employee

Could you try to add a script step before the ask for approval step and in the script pass back the approver list in an output variables?

DirkRedeker
Mega Sage

Hi

Just click the "script" button as shown in the screenshot and add the code as shown below.

The SysId in this case is from Fred Luddy.

I guess you can call your Script Include from here to add the SysIDs

Let me know if that answers your question

BR

Dirk

 

 

find_real_file.png