- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2024 11:02 AM
I have a flow that I want to have an interaction programmatically. Its trigger is a service catalog. It doesn't have inputs as the service catalog is the input itself.
I'm using this API ref: https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/Scri...
When a flow has no inputs but gets triggered by a service catalog. How do I pass the service catalog object as a parameter?
The documentation only includes inputs. Nothing for service catalog trigger.
I tried to pass a glidrecord object as an input but I get a datatype mismatch.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 12:04 PM
I have figured out the solution:
var grIncident = new GlideRecord('sc_req_item');
grIncident.get('6a173ae41b9c8e901c8f6570604bcb00');
var inputs = {};
inputs['request_item'] = grIncident;
var result = sn_fd.FlowAPI.getRunner()
.flow('x_gup_ansible_inte.new_server_build')
.withInputs(inputs)
.inForeground()
.run();
gs.info(result.debug());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2024 12:32 PM
Sorry, the requirement is not clear because if we want to generate requested item, then cart api can be used which will automatically trigger the flow associated with the catalog item.
If your requirement is to design a single flow which can be used for multiple catalog items, then you may explore dynamic flows
Below is OOB script which tags flow to the RITM automatically
startFlowDesignerFlow(current);
function startFlowDesignerFlow(current) {
var flow = current.cat_item.flow_designer_flow;
var flowName = flow.sys_scope.scope + "." + flow.internal_name;
sn_flow_trigger.FlowTriggerAPI.fireCatalogTrigger(flowName, current);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-11-2024 12:04 PM
I have figured out the solution:
var grIncident = new GlideRecord('sc_req_item');
grIncident.get('6a173ae41b9c8e901c8f6570604bcb00');
var inputs = {};
inputs['request_item'] = grIncident;
var result = sn_fd.FlowAPI.getRunner()
.flow('x_gup_ansible_inte.new_server_build')
.withInputs(inputs)
.inForeground()
.run();
gs.info(result.debug());