Transform Maps Date/Time updating wrongly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2024 11:25 PM
Hi,
The Target Date/Time is updating by adding extra 2 or 3 hours
For e.g:) My Source field string field value is 2024-05-09 11:29:47.0
Using the source script in the field mapping I am removing the .0
But the target date/time field is updated as 09/05/2024 15:07:19
Kindly assist.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 03:08 AM
I suggested to use transform script onBefore and use target.setValue('fieldName', convertedDate);
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2024 05:15 AM - edited 06-03-2024 07:03 AM
Hi @Ankur Bawiskar. Kindly assist on this.
I have tried the same in onbefore transform script as you suggested.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2024 07:41 PM
did you check was your time converted to GMT before setting the value using target object?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 10:55 PM
My bad. Just checked again and seems the transform map is in scoped application hence unable to use Package calls.
How can I convert this in scoped application?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2024 11:03 PM
this is sample script in scoped app which works
try as per your timezone
var now = new GlideDateTime();
gs.print("System Time is " + now);
var gsdt = new GlideScheduleDateTime(now);
gsdt.setTimeZone("Europe/London");
gs.print("London time is " + gsdt.getGlideDateTime().getDisplayValue());
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader