run subworkflows in a workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 01:10 AM
HI,
I am trying to run multi workflows asynchronously from run script activity in a different workflow. we tried to use sn_fd.FlowAPI but nothing happened
attaching the script-
for(var i=0; i<5; i++){
sn_fd.FlowAPI.getRunner().flow('global.flow_name').inBackground().withInputs(input_object).run();
}
I am looking at the workflow history and nothing happens.
Thank you!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 01:47 AM
Hi @Snow Tomcal
If I understood correctly, you want to run another flow from your parent flow. If Yes, you can make use of Create Code Snippet Utility and then try calling your flow.
https://www.servicenow.com/community/developer-forum/how-to-launch-a-flow-from-a-script/m-p/1370964
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 01:54 AM
Hello @Snow Tomcal,
I am not sure if your case is a flow or a workflow that you want to execute by a script, you are using the flow API if you want to call a workflow please try what was explained in this question:
https://www.servicenow.com/community/developer-forum/run-workflow-from-background-script/m-p/1904248
var gr = new GlideRecord('table');
gr.initialize();
gr.insert();
var wflw = new Workflow();
wflw.startFlow(wflw.getWorkflowFromName('give the workflow name'), gr, 'insert');
Hope that this helps you!
If the provided information answers your question, please consider marking it as Helpful and Accepting the Solution so other community users can find it faster.
All the Best,
Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 02:15 AM
thank you!
is there a way to send to the workflow a variable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 02:21 AM