How to pass value for Duration type input type in subflow from script include

ASHA22
Kilo Contributor

Hi,

we are calling a sub flow from script include like this.

Facing difficulty to pass the value for Duration Type input in flow designer

else {
var inputs = {};
inputs['record'] = grtechremainder;

inputs['reminder_duration_1'] = '0 hour(s) 10 minute(s) 0 second(s)'; // Duration
inputs['reminder_duration_2'] = 480000; // Duration
inputs['reminder_duration_3'] = 600000; // Duration
inputs['reminder_duration_4'] = 600000; // Duration

sn_fd.FlowAPI.getRunner().subflow('x_kpm13_enterprise.enterprise_standard_tech_status_reminder_notificatation').inBackground().withInputs(inputs).run();
}

And Flow is like this waiter should wait for 7 days. instead of adding 168 hrs in waiter condition we want to pass from script include. But i am not getting how to do that can you please help me on this

find_real_file.png

find_real_file.png

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

try to set the milliseconds value and check

600000

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi

Thanks for the input.

I have tried this but didnt work

Dawid K1
Tera Contributor

For future generations and future me: Use GlideDuration object. Example

 

var inputs = {
    duration: new GlideDuration(60000) // you can use ms value
    // or you can use duration string: new GlideDuration("00:01:00") 
    // see GlideDuration object documentation for more details
}

sn_fd.FlowAPI.startSubflow('global.<your_subflow_internal_name>', inputs);

 There may be other ways to pass this value, but this one worked for me.