Workflow call subflow and wait for it to finish? with "Run script" activity

Adam Maritz1
Giga Contributor

Hello,

I have been facing some issues with my Workflow that I am currently developing for our new request/approval flow.

Basically I want to call a subflow and return a value based on the approval response.

I know that you can run a subflow by picking it in the workflow editor and the parent workflow will wait until it reaches it end, but I am calling the subflow with the "Run Script" activity because the subflow I am calling on is based on the value of a reference field on the sc_cat_item, so it's a dynamic value.

The point of this is to make it easy to create items and connect multiple workflows to it without having to know much about Workflows.

I have tried with a "Wait for condition" activity but that only updates/validates when the current record updates, which is not always the case with the subflow.

Is it possible to make the "Run Script" activity call the subflow and wait for it to complete (like servicenow regular way of calling a subflow)?

Ill attach some images how my current workflow is built.

I would really appreciate any help with this.

Thanks!

1 ACCEPTED SOLUTION

Adam Maritz1
Giga Contributor

I managed to solve this on my own using the workflow activity "Parallel Flow Launcher".

View solution in original post

4 REPLIES 4

Apeksha Joshi
Kilo Guru

Hi there ,

please refer the following link :

https://community.servicenow.com/community?id=community_question&sys_id=5e288f6ddb1cdbc01dcaf3231f96...

If my reply helps you at all, I’d really appreciate it if you click the Helpful button and if my reply is the answer you were looking for, it would be awesome if you could click both the Helpful and Accepted Solution buttons! 

 

Regards,

Apeksha

Allen Andreas
Administrator
Administrator

Hi,

Sorry, not sure of the full context here, but couldn't you assign that field to a workflow scratchpad variable and then pass that along to your subflow so that you're calling it the OOB way so that it does wait for it?

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Adam Maritz1
Giga Contributor

I managed to solve this on my own using the workflow activity "Parallel Flow Launcher".

Hi @Adam Maritz, I am trying to call sub flow of a flow designer in workflow script activity. Based on flow out I will execute the workflow. But how do I make script activity to wait for the flow to complete.