Flow API - Service Catalog Input

Jocel_s
Tera Expert

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. 

1 ACCEPTED SOLUTION

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());

 

View solution in original post

6 REPLIES 6

amaradiswamy
Kilo Sage

can you elaborate more on the requirement? Do you want to run a flow on  specific table record or trigger a flow for requests?

Thanks for your reply. Basically, I have a Flow that gets run on a new item for service catalog. So its trigger is a service catalog. Within that flow, I have actions that reads the trigger and modifies the trigger as well. 

 

So then when I run the flow through a serverside script (from the API reference the I linked). My steps fail because I'm not able to specify a service catalog item via API. 

Why do you want to modify the trigger within the flow. Do you want to generate a request from another catalog item programmatically?

 

I'm not looking of modifying it. I want to run a flow programmatically. I want to feed it with a catalog item for trigger. .