Workflow with Trigger "Service Catalog" but Simulate Service Request - Submission with Scheduled Job
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 03:47 AM
Hi All,
Like the subject already says it:
I have a Workflow with a Trigger "Service Catalog" - this flow works perfectly fine using the catalog item and submitting a request.
Now I need to simulate/fake such a service request submission (depending on an automatic script schedule).
This script also works. A request and request item is created after executing the schedule. But the Workflow won't.
Do you have any tipps?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-18-2024 04:23 AM - edited ‎07-18-2024 04:26 AM
Without seeing the script you're using to generate the REQ & RITM I'm not able to say much but see the top response in: Solved: RITM Workflow Doesn't Trigger - ServiceNow Community
var grRITM = '??'; // The RITM GlideRecord
var w = new Workflow();
var wfSysId = w.getWorkflowFromName("workflowName");
var context = w.startFlow(wfSysId, grRITM, current.operation());
if (context != null){
grRITM.context = context.sys_id;
grRITM.update();
}
The script will instantiate a Workflow and associate it with the RITM. If you're using the CartAPI or whatever replaced this (as it might now be deprecated) then I would have expected the Workflow to have correctly associated with the RITM when it was generated.
The solution above was originally sourced from Request Generation Methods — ServiceNow Elite and there might be something helpful there if the above does not work.