- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2025 03:51 AM
Hello,
I have a workflow where I store variable values from RITM variables.
For example, let's say I have a catalog item called ABC. Once the request is submitted, I store some variable values from the RITM of that item, like:
var aa = current.variables.xyz; var bb = current.variables.abc;
Now, I am invoking a Subflow (Flow Designer) using a Run Script activity, and I need to pass the variables aa and bb to the Subflow. These variables need to be used within the Subflow to determine the next steps.
Can someone please guide me on how to pass workflow variables into a Subflow?
Thanks in advance 🙂
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2025 04:01 AM
something like this
try {
var aa = current.variables.xyz;
var bb = current.variables.abc;
var inputs = {};
inputs['inputVariable1'] = aa;
inputs['inputVariable2'] = bb;
var result = sn_fd.FlowAPI.getRunner().subflow('subflowName').inBackground().withInputs(inputs).run();
var outputs = result.getOutputs();
} catch (ex) {
var message = ex.getMessage();
gs.error(message);
}
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-17-2025 08:05 AM
you can run the flow in foreground so that you get the flow completed and then only next line will work
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