updating datetime field with business Rule

Ujjwal1
Tera Contributor

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

5 REPLIES 5

Mohith Devatte
Tera Sage
Tera Sage

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

 

Hi @Mohith Devatte 

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

newhand
Mega Sage

@Ujjwal1 

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!!

 

 

 

Please mark my answer as correct and helpful based on Impact.

Ujjwal1
Tera Contributor

@newhand 

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