- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2021 10:05 AM
Hey Guys,
I have to update time zone for specific client. There are 1300 user under that client.
Manual task would take too much time. Can't move XML to UAT & PROD due to sys_id mismatch.
Is there any script that can be run and change time zone?
If yes please help me or provide any suggestion to reduce this manual task.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2021 10:44 AM
You can use and run below fix script to change time zone for existing users.
var gr = new GlideRecord('sys_user');
gr.addEncodedQuery();//query to find out user records to update
gr.query();
while (gr.next()) {
gr.time_zone = 'Canada/Pacific'; // you can get these values from sys_choice table for time_zone field like https://<<<your_instance_name>>>.service-now.com/sys_choice_list.do?sysparm_query=element%3Dtime_zone%5Ename%3Dsys_user&sysparm_view=
gr.setWorkflow(false); // Don't run business rules for this update
gr.update();
}
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-19-2021 10:44 AM
You can use and run below fix script to change time zone for existing users.
var gr = new GlideRecord('sys_user');
gr.addEncodedQuery();//query to find out user records to update
gr.query();
while (gr.next()) {
gr.time_zone = 'Canada/Pacific'; // you can get these values from sys_choice table for time_zone field like https://<<<your_instance_name>>>.service-now.com/sys_choice_list.do?sysparm_query=element%3Dtime_zone%5Ename%3Dsys_user&sysparm_view=
gr.setWorkflow(false); // Don't run business rules for this update
gr.update();
}
Regards,
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2021 04:19 AM
Hi,
Thank you .
Tested for 1 user.
It's working.
var gr = new GlideRecord('sys_user');
gr.addEncodedQuery('sys_domainLIKEryder^user_nameSTARTSWITHVarity_Randall@ryder.com');//query to find out user records to update
gr.query();
while (gr.next()) {
gr.time_zone = 'Europe/London'; // you can get these values from sys_choice table for time_zone field like https://<<<your_instance_name>>>.service-now.com/sys_choice_list.do?sysparm_query=element%3Dtime_zone%5Ename%3Dsys_user&sysparm_view=
gr.setWorkflow(false); // Don't run business rules for this update
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2023 05:40 AM
Hi,
Where do we run this script and is there conditions?
Can I use below:
gr.time_zone = current.location.time_zone;
Thanks
Chin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2023 12:02 AM
Hi,
You can refer the below link to convert timezone :
Thanks,
Kathiresan S
Thanks,
Kathiresan S