Dynamically set user time zone

Justin Lucas
Kilo Sage

Hi all,

 

We are trying to automatically set time zones for users based on where they logged in from. For example, the system default is America/Los_Angeles but if the user logged in from New York, we would want the time zone to automatically change to US/Eastern without requiring the user to manually set this preference.

 

Looking at User Experience Analytics > Dashboard, it appears to track the "Last Location" of a user, so I'm hoping we can leverage this or something similar to set which time zone the user is in.

 

Any idea on how we can target the location a user logged in from (similar to User Experience Analytics) and use that to determine which time zone they are currently in?

 

Thanks,

 

Justin

1 REPLY 1

sourav1999
Mega Guru

-User time zone can be set dynamically in ServiceNow by using the getClientData() method

-The getClientData() method returns the user's time zone as a string

-The setTimeZone() method can be used to set the user's time zone in ServiceNow

-The setTimeZone() method takes the user's time zone string as an argument

-The setTimeZone() method should be used in an onLoad client script to ensure the user's time zone is set correctly

 

For asking ServiceNow-related questions try this :

For a better and more optimistic result, please visit this website. It uses a Chat Generative Pre-Trained Transformer ( GPT ) technology for solving ServiceNow-related issues.

Link - https://nowgpt.ai/

 

For the ServiceNow Certified System Administrator exams try this :

https://www.udemy.com/course/servicenow-csa-admin-certification-exam-2023/?couponCode=NOW-DEVELOPER