- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
Hi All,
I am trying to call a flow from workflow using Run flow/subflow/action activity. Flow name has been added but on running the flow i am getting following error.
Please assit.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
that doesn't answer the above question.
Are you calling flow or subflow?
If you are calling subflow then what input it's asking? are you sending that ?
share the screenshots of your subflow
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
Monday
How to pass value of catalog variables to the flow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
Hi,
You can pass the catalog variables like the following example:
(function() {
try {
var inputs = {};
// 1. Pass the current record (the RITM)
inputs['record'] = current;
// 2. Access the catalog variables and add them to the inputs object.
// To pass a single-line text variable named 'requester_email':
inputs['user_email'] = current.variables.requester_email;
// To pass a reference variable named 'new_laptop_model':
// For reference variables, you often need the sys_id:
inputs['laptop_sys_id'] = current.variables.new_laptop_model.sys_id;
// If your flow input is expecting the Display Value (string):
// inputs['laptop_display_name'] = current.variables.new_laptop_model.getDisplayValue();
var flowName = 'global.your_flow_name';
var result = sn_fd.FlowAPI.getRunner().flow(flowName).inForeground().withInputs(inputs).run();
} catch (ex) {
var message = ex.getMessage();
gs.error('Error calling flow from workflow: ' + message);
}
})();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday - last edited Monday
@Nikita50 - try calling subflow from the workflow, i did this in our project-
script:
try {
var inputs = {};
inputs['task_sys_id'] = current.sys_id.toString();
inputs['task_number'] = current.number.toString();
inputs['jira_issue_key'] = current.correlation_id.toString();
inputs['change_summary'] = 'Task deactivated - Current State: ' + currentStateDisplay;
inputs['state_details'] = currentStateDisplay;
inputs['updated_by'] = gs.getUserName();
inputs['updated_on'] = new GlideDateTime().getDisplayValue();
// Start the subflow
var result = sn_fd.FlowAPI.getRunner()
.subflow('global.sc_task_to_jira_state_sync')
.inForeground()
.withInputs(inputs)
.run();
var outputs = result.getOutputs();
gs.info('Jira state sync subflow triggered for task: ' + current.number +
' (Deactivated - State: ' + currentStateDisplay + ') by user: ' + gs.getUserName());
} catch (ex) {
var message = "Error occurred in Jira state sync: " + ex;
gs.error(message);
}
Just make sure you create all the inputs for the subflow and use it in the script as inputs['subflowInput']
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
are you calling flow or subflow?
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
Monday
Calling flow from workflow using Run flow/subflow/action activity.