- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2018 01:58 PM
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.
Any help would be appreciated!
Solved! Go to Solution.
- Labels:
-
Discovery
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2018 03:01 PM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2018 02:02 PM
Can we see what your script looks like so far?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2018 02:12 PM
// Insert values in AWS Discovery Schedule
if (workflow.scratchpad.aws.account_cred_sys_id) {
var disSched = new GlideRecord('discovery_schedule');
disSched.initialize();
disSched.name = workflow.scratchpad.aws.account_name;
disSched.discover = 'Web Service';
disSched.disco_run_type = 'daily';
disSched.run_time =
disSched.insert();
workflow.scratchpad.aws.discoverySchedule_sys_id = disSched.sys_id;
I am specifically struggling to find the syntax for how to format the "run_time"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2018 03:01 PM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-13-2018 09:07 AM
gah. gt.setValue.
Somehow the 't' escaped.