Run same workflow multiple times based on records from GlideRecord query
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-08-2017 10:34 AM
I have a list of items that I need to create an Incident for each of those items.
What is the best way to do that?
1. My first thought is in the scheduled job that will run nightly get my list of items that I need Incidents created for and start the workflow to do the processes for each item.
???I believe that will work, but not sure of the performance issues of having up to 150 (at most, probably much less than that) workflows running on the Incident table at a time.
2. Directly in a workflow can a use Run Script to get my list of items then use a 'Parallel Flow Launcher' to create the Incidents?
I've never utilized 'Parallel Flow Launcher' and haven' found a good example of running the same workflow over and over from the items queried in Run script.
Any suggestions on the best way to handle this would be appreiciated!!
- Labels:
-
Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2017 03:03 PM
Christina,
We are glad you took advantage of the ServiceNow Community to learn more and to get your questions answered. The Customer Experience Team is working hard to ensure that the Community experience is most optimal for our customers.
If you feel that your question was answered, we would greatly appreciate if you could mark the appropriate thread as "Correct Answer". This allows other customers to learn from your thread and improves the ServiceNow Community experience.
If you are viewing this from the Community inbox you will not see the correct answer button. If so, please review How to Mark Answers Correct From Inbox View.
Thanks,
Shivani Patel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-09-2017 05:52 PM
I am not clear about the business case ,but below can be used as an example to call multiple workflow instances using parallel flow.your query will loop through the items and generate that many subflows. coordinator = new WorkflowCoordinator( {workflow:'Sub flow name'} ); var gr= new GlideRecord('cmdb_ci'); gr.addEncodedQuery('your query'); gr.query(); while(gr.next()) { coordinator.add( { input1:'abc', // inputs to subflow ,you need to define input in the sub flow first to use this input2:'xyz', } ); } coordinator;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2017 07:49 AM
Thank you for your response, the business case is that for a list of apps there is a workflow that needs to run for each (same workflow just different app). I was researching the use of the Parallel Flow Launcher, but did not feel that based on my use case that I needed the workflow coordinator. Bc I'm running the same workflow, would you agree?
Also, are there any issues with having multiple instances of the same workflow running?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2017 10:07 AM
Parallel flow launcher is used from a workflow ,so the trigger is from a parent workflow .There are no issues in using parallel flow as the instances will be based on the input that you provide.But again,I am not clear on your business case. If you want to check CI's and then create incidents against it ,why do you want to use workflows for it ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2017 10:54 AM
My business case is more than just creating the INC's. The need is to review our applications (this entails a workflow that has an infrastructure review/approval & an applications approval). That's why I'm asking about the parallel flow launcher.
In this business case I want to create a INC to a certain group, wait for it to be done, then create another INC to another group and wait for that to be done (hence the workflow). Hope that helps explain my position.