Run same workflow multiple times based on records from GlideRecord query

clyon
Tera Guru

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!!

11 REPLIES 11

Michael Ritchie
ServiceNow Employee
ServiceNow Employee

I would create a workflow against the incident table and set the conditions to run for your specific incidents.   Assume they have certain data attributes you can look for in the condition.



Then just create a script that will generate the incidents.   Then the workflow will start automatically once the incident is created.



No concerns on that number of incidents with running workflows.   ServiceNow can absolutely handle that.


That doesn't fit my business case.


I have cmdb items that need to be reviewed, so I was going to run a scheduled job, nightly to see what needed to be reviewed and anything that did create a Incident.



BUT to your point, I could have a workflow on the cmdb table needed and conditions on the workflow to trigger when the cmdb record fits the condition. BUT what keeps workflow from running multiple times (due to the record being in that workflow condition state for an extended period of time?


Thank you for the additional clarification.



Have you considered using the Data Certification application?   Seems like it would solve your use case:


Data Certification


Christina,



script part in the scheduled job can do this. first query the cmdb tables for the list of cis, then you can create incidents for each of them. in the script, you can check if incident is not already created for a particular ci.