Create Discovery Schedule from run Script

Austin Rion1
Tera Contributor

I am working on a workflow to automate the onboarding of AWS Cloud management. I am trying to create a Run script in my WF that will create a Discovery schedule, I am struggling to find the correct syntax to add the "time" via the script. 

find_real_file.png

Any help would be appreciated! 

1 ACCEPTED SOLUTION

Ok, so looking at the discovery_schedule table, run_time is a GlideTime.

Based on that, and a little tinkering, I think I would do this:

var SECS = 1000;
var MINS = 60 * SECS;
var HOURS = 60 * MINS;
disSched.run_time = new GlideTime(5 * HOURS).getValue();

or

var gt = new GlideTime();
gt.seValue("05:00:00");
disSched.run_time = gt.getValue();

View solution in original post

5 REPLIES 5

Marlos
ServiceNow Employee
ServiceNow Employee

run_time is the number of hours, minutes and seconds since 1970-01-01 08:00:00,

 

If you set the time on the form to 01:00:00, then run_time will be 1970-01-01 09:00:00