- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-01-2015 11:25 AM
...Hello.
I'm creating a record producer to create both a parent Schedule and a related Schedule Entry.
Mostly everything else is working with the exception of setting the Time Zone. Because it's a scheduleDateTime field (on the new entry/span record it's not populating from the record producer. Is anyone aware of how I append the timezone to the last 2 lines of the script below? The date and time is passed but not the timezone.
****UPDATE: hardcoding it to set timezone doesn't work either. Anyone have any suggestions on how to pass the time/date/timezone into the XML formatter on the Schedule Entry page?
Thx
//Create new parent Schedule with related Schedule Span
current.type = "customer";
current.name = producer.name;
// create Schedule Span 1 for Monday-Friday business hours
var spanTask = new GlideRecord('cmn_schedule_span');
spanTask.initialize();
spanTask.name = "Business Hours for: " + producer.name.getDisplayValue();
spanTask.schedule = current.sys_id;
spanTask.u_customer_name = producer.name.getDisplayValue();
spanTask.start_date_time = new GlideScheduleDateTime(producer.sdt);
spanTask.end_date_time = new GlideScheduleDateTime(producer.edt);
//
producer.sdt.setTZ(producer.time_zone);
producer.edt.setTZ(producer.time_zone);
spanTask.insert();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2015 12:43 PM
Thanks to Ryan at SN.
The answer is below:
spanTask.start_date_time = new GlideScheduleDateTime(producer.sdt.getDisplayValue());
spanTask.end_date_time = new GlideScheduleDateTime(producer.edt.getDisplayValue());
The date/time/timezone is passed into start_date_time field and the record updates correctly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2015 12:43 PM
Thanks to Ryan at SN.
The answer is below:
spanTask.start_date_time = new GlideScheduleDateTime(producer.sdt.getDisplayValue());
spanTask.end_date_time = new GlideScheduleDateTime(producer.edt.getDisplayValue());
The date/time/timezone is passed into start_date_time field and the record updates correctly.