updating datetime field with business Rule
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2023 10:39 PM
Hi
We have a field"lastTicketAssigned", which is dateTime type.
Value is set by BR (=GlideDateTime().getDisplayValue());)
Issue : As of now it is updating system date time of system timezone. Can we update this field based on local time of logged in user, who is triggering this BR.
Thanks
Ujjwal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2023 10:43 PM - edited 01-16-2023 10:48 PM
Hello @Ujjwal1 ,
can you try this
var gdt = new GlideDateTime();
gs.info(gdt.getLocalDate());
gs.info(gdt.getLocalTime());
Hope this helps
Mark my answer correct if this helps you
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 12:44 AM
Thanks for your input
Requirement is it lastTicketAssigned should be updated based on when BR is running.
Although i am IST timezone. But BR is updating this field in +5:30 hr timezone(not in IST)
Thanks
Ujjwal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2023 10:54 PM - edited 01-16-2023 10:57 PM
By default ServiceNow now stores date in the system timezone.. and it shows the date on the user's time zone.
>We have a field"lastTicketAssigned", which is dateTime type.
>Value is set by BR (=GlideDateTime().getDisplayValue());)
I think the problmen is here....
I can't understand why you set the localtime string to the field....
User can change his time zone! when user changes his time zone, the date will be out of control!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-17-2023 12:43 AM
Thanks for your input
Requirement is it lastTicketAssigned should be updated based on when BR is running.
Although i am IST timezone. But BR is updating this field in +5:30 hr timezone(not in IST)
Thanks
Ujjwal