How to trigger a workflow from a flow designer via run script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 05:45 AM - edited 02-06-2023 05:46 AM
Hi All,
I need to trigger a workflow that is configured for sc_req_item table from an intermediate step in a flow. Can someone please help me with the exact script to achieve this as I cant call call a workflow flow logic on any workflow for sc_req_item table. The flow is on service catalog trigger. Also I need to hold the flow from proceeding until the workflow is completed which is triggerred via the run script in FD. Can someone please help me with this as its urgent.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 06:03 AM
var w = new Workflow();
var context = w.startFlow(w.getWorkflowFromName('Name of the workflow'), null, null, inputs);
Please mark correct if my response has solved your query.
Cheers,
Mohammed Basheer Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 06:09 AM
Hi Basheer,
What are those null parameters passed? And if I dont have any input variables in my workflow, then what do I need to pass. Also how to make the flow wait until the workflow is completed executing to proceed further.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 06:24 AM
why not embed the workflow logic in flow itself?
Why to maintain flow and workflow both?
the sample script if you still require it is shared already. Ensure you pass correct workflow name and inputs
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2023 06:27 AM
Hi Ankur,
In our use case, actuvally the part configured in the workflow is pretty difficult/impossible to implement in flow designer. Hence why I need to have the workflow triggered from the script. Can you please suggest how to hold the flow execution until the workflow is completed.
Thanks!