Run Flow from script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2023 06:30 AM
Hi Everyone,
I am trying to run a Flow from a background script (final goal is to run it from fix script).
However, flow is not triggering, here is the script:
var inputs = {};
inputs["table_name"] = "sc_req_item";
inputs["request_item"] = "RITMXXXXXX"; // here I input RITM number
sn_fd.FlowAPI.executeFlow("global.the_flow_name", inputs );
}
I also tried with startFlow instead of executeFlow, but result is the same.
Am I missing something here ?
Thank you very much in advance for your support !
Kr,
Sylvain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-30-2023 06:44 AM
Hi
For the inputs you need to pass GlideRecord Object( gliderecord to ritm table and get the gliderecord object of the RITM)
try by removing
inputs["request_item"] = "RITMXXXXXX";
and pass
inputs["current"] = GlideRecord Object
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 02:30 AM
Hello Girish,
Thank you very much for your reply.
I tried the above but result is the same:
var grRITM= new GlideRecord("sc_req_item");
grRITM.get("RITM2486673");
var inputs = {};
inputs["table_name"] = "sc_req_item";
inputs["current"] = grRITM.number;
sn_fd.FlowAPI.executeFlow("global.demand_management_for_im_products__release", inputs );
Is this what you meant ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-22-2025 11:43 AM
Too late but maybe someone can use it...
var gr = new GlideRecord('task_time_worked');
gr.get('sys_id');
try {
var inputs = {};
inputs['current'] = gr; // GlideRecord of table:
inputs['table_name'] = 'task_time_worked';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2023 02:47 AM
Hi @Sylvain12 ,
Try this :
var grr = new GlideRecord('sc_req_item');
grr.addQuery('number', 'RITMXXXX');
grr.Query();
if(grr.next()){
var inputs = {};
inputs["table_name"] = "sc_req_item";
inputs["request_item"] = grr;
sn_fd.FlowAPI.executeFlow("global.the_flow_name", inputs );
}
☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....