variables to subworkflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 03:17 AM
Hi,
I an trying to add variaqbles to workflow, this is what I did-
var gr = new GlideRecord('table');
gr.addQuery('sys_id','sys id of a record');
gr.query();
if(gr.next())
{
var wflw = new Workflow();
wflw.startFlow(wflw.getWorkflowFromName('give the workflow name'), gr, 'insert');
}
How do I add variables to the new workflow?
Thank You!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-10-2024 03:36 AM
I shared detailed steps here, have a look
Trouble Accessing variables from inbound action
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
01-10-2024 03:47 AM
Hi @Snow Tomcal ,
You need to create a input in workflow, and using that colum name in script, you can pass the parameter.
Script may somewhat look like :
var gr = new GlideRecord('table');
gr.addQuery('sys_id','sys id of a record');
gr.query();
var workVars = {};
workVars.input_1 = 'XYZ';
if(gr.next())
{
var wflw = new Workflow();
wflw.startFlow(wflw.getWorkflowFromName('give the workflow name'), gr, 'insert',workVars);
}
Thanks and Regards,
Rahul