How to trigger a workflow through UI page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 05:11 AM
Hi Team,
We have "Reschedule Change" button on the change form.
once user fill the details and click the "yes" button need to trigger the workflow.
I have written code but its not working.
HTML:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 06:01 AM
is it going inside the processing script
if yes then current object won't work in processing script
you need to pass the record sysId, GlideRecord it and then use that object
var recordSysId = my_sys_id;
var gr = new GlideRecord("change_request");
gr.addQuery("sys_id", recordSysId);
gr.query();
if (gr.next()) {
var workflowId;
workflow = new Workflow();
workflowId = workflow.getWorkflowFromName('Reschedule Change ');
workflow.startFlow(workflowId, gr, 'Reschedule Change ', null);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-29-2024 06:41 AM
Hi Ankur,
Thanks for the quick response.
Once i have filled the details after click the yes button.
It returns to the below page:
I want to update set the values in the change form.
Please provide the solution.
Regards,
Mahesh