Need Help with Passing Date/Time in a "Schedule Date/Time" formatted field to a "Date/Time" field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2022 08:49 AM
I have a requirement to report on the roster_schedule_span table there are two fields on this table called start date time and end date time that we will need to report on. These fields are of the Schedule date/time type which do not allow you many condition operators to choose from (there are 3). So to get around this I've decided to create two custom date/time type fields, one called u_donotuse_start and the other is u_donotuse_end . I created those on the roster_schedule_span table with hopes of creating a client script to populate them with the date and time from the end date time and start date time fields. What I've scripted so far (novice scripter) is placing an "undefined" in the u_donotuse_end date field. Please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2022 10:31 AM
g_form.getValue('start_date_time') would do, getReference is not needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2022 12:39 PM
That did not work either. Now instead of undefined it's blank. The client script is being built on the roster_scheduled_plan table and although the Start Date Time is on this form it's being referenced by another table cmn_schedule_span my reason for utilizing getReference.
Both the date/time field type and schedule date/time field types are formatted differently as you can tell in the screen shot which leads me to believe there is some type of translation issue...reason I'm getting undefined in the field using my original script. Let me know if you have any other ideas. Thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2022 04:03 PM
Still struggling with this. I've gotten this far.....
Script taken from Client Side Dates in ServiceNow - ServiceNow Guru
Which produced these results.....
This seems a bit problematic because "(DoNotUse)Start" field should produce the following format.......
I need the script to translate correctly. Any other suggestions?