Ho we can call workflow from another workflow.

niveditakumari
Mega Sage

Hi, 

 

Ho we can call workflow from another workflow. 

Can you give one example for it. 

 

Regards, 

Nivedita

 

 

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

Hello Nivedita!

You can accomplish this by dragging a workflow from the Workflows list/pane on the right of the Workflow Editor onto a checked out workflow.  This creates a Workflow Instance activity on the main workflow, noting the name of the sub-flow.  If you want the sub-flow to return a value that you can use in the main workflow, populate the 'Map return value field' with something like

${workflow.scratchpad.subflow_result}

Then in the sub-flow right before the End activity use a Return Value activity (under Utilities) to set a value that will populate this workflow variable. So let's say the Return Value is set to 'approved', then back in the main workflow you can add an if activity coming out of the Workflow Instance activity to test whether the subflow resulted in approved or something else by referencing 

workflow.scratchpad.approval_result == 'approved'

in the if script.

View solution in original post

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

Hello Nivedita!

You can accomplish this by dragging a workflow from the Workflows list/pane on the right of the Workflow Editor onto a checked out workflow.  This creates a Workflow Instance activity on the main workflow, noting the name of the sub-flow.  If you want the sub-flow to return a value that you can use in the main workflow, populate the 'Map return value field' with something like

${workflow.scratchpad.subflow_result}

Then in the sub-flow right before the End activity use a Return Value activity (under Utilities) to set a value that will populate this workflow variable. So let's say the Return Value is set to 'approved', then back in the main workflow you can add an if activity coming out of the Workflow Instance activity to test whether the subflow resulted in approved or something else by referencing 

workflow.scratchpad.approval_result == 'approved'

in the if script.