Starting a workflow within a run script activity
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 12:24 AM
Hi there,
I have a requirement that when a CI is submitted with an excel sheet, new RITMs will be created for each row in the spreadsheet. So far I have managed to create the new RITMs, but I want the same workflow the run script activity is in to run from that point on the new RITMs. How would I go about doing this?
Additionally I want to fill in same fields that were on the original service catalog form within the workflow for each of these new RITMs. How would I go about doing this?
Any help would be much appreciated.
Kind regards,
G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 12:31 AM
Hello @gunishi
Below link might help you..!!
Used same logic as you only I'm creating the multiple RITM using list collector.
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 01:14 AM
Thank you so much for your swift response, I've found all your answers so far very helpful!
Do you think this function would work to trigger a workflow:
function startWorkFlow(ritmSysID) {
var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request', request);
ritm.addQuery('sys_id', '!=', current.sys_id);
ritm.addNullQuery('context');
ritm.query();
while (ritm.next()) { ritm.setForceUpdate(true);
ritm.update();
}
}
Any comments or feedback would be much appreciated.
Kind regards,
G
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 02:33 AM
Hi @gunishi
This will not start the workflow.
To start workflow you need to pass the workflow context sys_id (wf_workflow table)
Here you are passing the ritm sys_id.
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2023 03:53 AM