Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Inputs to flow designer script is not working

Kavya16
Tera Expert

Dear All,

I tried to write a script for task sla table, but its not  accepting the inputs if i provide the sys_id..Please help. It says input is invalid. Trigger of my flow is task sla.

var inputs = {};
inputs['sys_id'] = '23f306c4dbc7c1d0f328a05605961910';
var result = sn_fd.FlowAPI.getRunner() 
.flow('global.test123')
.inBackground() 
.withInputs(inputs)
.run(); // 

var contextId = result.getContextId();
gs.info(contextId)

 

Kind Regards,

Kavya

5 REPLIES 5

Hello Kavya,

I don't know if this will help you, but it might help someone with the same question.

To get the sla_flow_inputs you can open a similar triggered sla flow, click the on trigger  pill and copy the value from the sla_flow_inputs object.

 

ph_paterlini_0-1710539974413.png

ph_paterlini_1-1710540041893.png

I tried the script below and it worked! You will also need to get and change the current task_sla record and the technical name of the flow.

var inputs = {};
inputs['sla_flow_inputs'] = {
         "duration": "1970-01-04 00:00:00",
         "duration_type": null,
         "is_repair": false,
         "name": "Resolução de Solicitação - 72 horas",
         "relative_duration_works_on": "Task record"
}
inputs['task_sla_record'] = current; 

sn_fd.FlowAPI.getRunner().flow('global.FLOW_NAME').inForeground().withInputs(inputs).run();