web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Is there a way for me to get a User record's timezone settings?

(0) ShareShare
ReportReport
Posted on by 1,272

Is there an out of the box field for User records which determines the Timezone set on their personal settings?

Let say I am User A and I would like to retrieve User B's timezone settings.

Any ideas?

*This post is locked for comments

I have the same question (0)
  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: Is there a way for me to get a User record's timezone settings?

    Hi Marjorie,

    You can retrieve the information by passing GUID in the  UserSettings entity -

    If you want to write server side code check here -

    docs.microsoft.com/.../sample-retrieve-time-zone-information

    For client side check here -

    crmgreenbible.blogspot.com/.../get-crm-2011-timezone-settings-for.html

    Although above script is old way to retrieve information but you can replace with  new web api.

  • Suggested answer
    PranavShroti Profile Picture
    4,510 on at
    RE: Is there a way for me to get a User record's timezone settings?

    Hi Marjorie,

    you can use a utility XrmToolBox (https://www.xrmtoolbox.com/)

    The utility allows you to quickly and easily update/retrieve system user settings for multiple users from one central location. System Administrators can select a group of users and set attributes such as the default pane, language time zone, default calendar, records per pages etc. Of particular interest are the Email Settings, where you can specify which emails to track and whether to automatically create records in CRM.

    Download and extract the toolkit from http://www.xrmtoolbox.com/

    Connect to your CRM organization using the Connection page

    Once connected you will be able to browse the many tools available to you. Locate the User Settings Utility.

    Regards,

    Pranav

    If found useful, please mark the answer as verified

  • LeoAlt Profile Picture
    16,331 Moderator on at
    RE: Is there a way for me to get a User record's timezone settings?

    Hi Marjorie,

    Each user can modify his own Timezone in personal options.

    You can click the gear on the right side of the navigation bar and select options

    WeChat-Screenshot_5F00_20180928124618.png

    Then you can set your personal Timezone on General tab.

    WeChat-Screenshot_5F00_20180928124618.png

    But there is no OOB features to set other user's Timezone.

    May be you can achieve this by custom tools.

    Hope it helps.

    Best Regards

    Leo

  • MRVIX Profile Picture
    1,272 on at
    RE: Is there a way for me to get a User record's timezone settings?

    Hi All,

    Thank you for all your response.

    The reason I'm asking is that using a Custom Workflow Activity, I would like to get the Owner of the record(WHICH IS NOT THE CURRENT USER) and capture the timezone set to that specific User.

    Any ideas? Thanks!

  • MRVIX Profile Picture
    1,272 on at
    RE: Is there a way for me to get a User record's timezone settings?

    Hi Goutam,

    Seems like it is working using a Plugin and not in my Custom Workflow. Any thoughts?

    I used this, 

    new QueryExpression("systemuser")
    {
    ColumnSet = new ColumnSet("localeid", "timezonecode"),

    Criteria = new FilterExpression
    {
    Conditions =
    {
    new ConditionExpression("systemuserid", ConditionOperator.EqualUserId)
    }
    }
    }).Entities[0].ToEntity<Entity>();

    Here's what I'm getting...

    2018_2D00_09_2D00_28_5F00_14h11_5F00_24.png

  • MRVIX Profile Picture
    1,272 on at
    RE: Is there a way for me to get a User record's timezone settings?

    To add,

    for me to be able to get the ID of the User in the Owner field I changed the ConditionExpression to this,

    Conditions =

                  {

                       new ConditionExpression("systemuserid", ConditionOperator.Equal, userId)

                  }

  • MRVIX Profile Picture
    1,272 on at
    RE: Is there a way for me to get a User record's timezone settings?

    Got it!

    new QueryExpression("systemuser")

    The systemuser should be "usersettings"

    it's now working! :)

    Thanks everyone!

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at
    RE: Is there a way for me to get a User record's timezone settings?

    Hi Marjoorie,

    It would be same for Plugin/ custom workflow activity. The error you are gettign is because you have used system user entity, you need to add "usersetting" entity

    Here is the sample code

    ============

    var queryUserTimezone = new QueryExpression("usersettings")

                   {

                       ColumnSet = new ColumnSet("localeid", "timezonecode"),

                       Criteria = new FilterExpression

                       {

                           Conditions =

                           {

                               new ConditionExpression("systemuserid", ConditionOperator.Equal, systemUserId)

                           }

                       }

                   };

                   var results = service.RetrieveMultiple(queryUserTimezone);

                   if (results != null && results.Entities.Count > 0)

                   {

                       var timeZoneCode = results.Entities[0]["timezonecode"];

                       Console.WriteLine(timeZoneCode);

                   }

    ===============

    Hope this helps.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

#3
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans