Calling sub-flow (flow designer) from legacy Workflow

Asmita7
Tera Expert

Hello Friends,

 

I have already created a Flow designer to add details in a table. I am currently modifying a Workflow. I need to call a Sub-flow (flow designer) from my workflow ?

1. I tried using core activity Run sub-flow from Workflow. 

2. I have added sub-flow inputs in Workflow in Has Inputs section through a code.

e.g. answer = {};

answer['user'] = 'sys_id';

answer['entitlement']='sys_id';

Both user and entitlement are inputs in sub-flow with reference data type. 

But this gives error during execution of workflow in RITM.

Any idea to resolve this?

Any other approach to call Sub-flow from a Workflow?

 

Please help.

Your help will be appreciated.

 

Thank you,

Asmi

8 REPLIES 8

Ankur Bawiskar
Tera Patron

@Asmita7 

share how you are calling that subflow using workflow?

may be the inputs you are passing are not of the correct type

share subflow screenshots

💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏

Thank you @Ankur Bawiskar  for reply.

I am using Workflow Core Activity : Run Flow/subflow/action 

Inside this activity, I am selecting the Subflow.

Than "Has Inputs" checkbox is selected. It enables the Script. Inside the script I am providing Sub-flow inputs. Subflow has 3 inputs 

1. emp_type     ------ String

2. user     ------- Reference

3. software_model   ------ Reference

For these inputs I am using script as:

answer = {};

answer['emp_type'] = 'Perm';

answer['user']= 'sys_id';

answer['software_model']='sys_id';

 

@Asmita7 

better with screenshots

Tanushree Maiti
Tera Patron

 

Hi  @Asmita7 

 

In my last project we called subflow from Workflow using run script via sn_fd.FlowAPI . 

https://www.servicenow.com/docs/r/api-reference/server-api-reference/ScriptableFlowAPI.html

 

You need to pass correct sys_id (string) for user and entitlement as input  .

If you need to pass the input , you can check this video  for the script on how to to pass inputs via sn_fd.FlowAPI. 

https://www.youtube.com/watch?v=_P1Yz-KLrOk&t=13s

 

 

See how to trigger a subflow in ServiceNow flow designer using a SERVER side script..in this example we use a UI Action script. We discuss the different flow api's we can play with: FlowAPI, ScriptableFlowRunner, GlideFlow (briefly) and take a look at how we use nifty ServiceNow flow designer ...