
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2011 08:53 AM
I would like to be able to set the time zone for a location and for users that have that location in their user record, to have the location time zone as their default time zone. As our proposed feed of user data does not indicate time zone preferences, just looking for an easier way to default the time zone on the initial and subsequent loads of user data.
For example.
Joe Smith's user data is imported to the user record with a location of Dallas, TX. The system then sets Joe Smith's time zone in his user record to what is indicated as the time zone on the location record for Dallas.
I would think this would be possible with some scripting in the user time zone field default value, or am I way off?
Solved! Go to Solution.
- Labels:
-
Orchestration (ITOM)
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2011 07:55 AM
Generally, that should work. My suggest would be a business rule run on update of the user record with a condition for when the user location changes. The rule would be something like:
current.time_zone = current.location.time_zone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2011 07:55 AM
Generally, that should work. My suggest would be a business rule run on update of the user record with a condition for when the user location changes. The rule would be something like:
current.time_zone = current.location.time_zone
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2013 12:02 PM
How could I run this to switch all users to their locations timezone to update all current users?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-14-2013 06:41 AM
I setup a scheduled job for the first pass, then a business rule for subsequent changes. The scheduled job is set for one demand so if I see a need to run again I can do it easily.
Here is the code I used to set them initially.
gs.log("Set Users Time Zone> START " + gs.now());
var gr = new GlideRecord('sys_user');
gr.query();
while (gr.next()) {
if (!gr.location.time_zone.nil()) {
gr.time_zone = gr.location.time_zone;
gr.update();
}
}
gs.log("Set Users Time Zone> END" + gs.nowDateTime());
<\code>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-15-2018 05:00 AM
Hi there, could you please confirm details of the business rule you utilise for changes - and do you just run this on change of user location?
We had an issue recently where a Location.Time zone value update subsequently meant the update of 787 user record time zone values (due to an insert/update sys_user business rule 'Set Time Zone from Location') and subsequently appears to have caused a 20min instance outage... not good!
This current business rule script is as below and looks to be the same as your scheduled job above (it was created in our instance by a 3rd party consultant when we first implemented SN):
gs.log("Set Users Time Zone> START " + gs.now());
var gr = new GlideRecord('sys_user');
gr.query();
while (gr.next()) {
if (!gr.location.time_zone.nil()) {
gr.time_zone = gr.location.time_zone;
gr.update();
}
}
gs.log("Set Users Time Zone> END" + gs.nowDateTime());
Thanks for any help in advance.