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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

How to update Enum property of a DataEntity using Odata in D365FO

(0) ShareShare
ReportReport
Posted on by 85

Hi,

I am trying to figure out how to update a property in DataEntity (for ex: SystemUsers) which is of type Enum (for ex: "Microsoft.Dynamics.DataEntities.Timezone")

Question 1:


There is a property "PreferredTimeZone" in SystemUser data-entity. This PreferredTimeZone property is defined as Enum as follows:

<Property Name="PreferredTimeZone" Type="Microsoft.Dynamics.DataEntities.Timezone">
                    <Annotation Term="Microsoft.Dynamics.OData.Core.V1.LabelId" String="Preferred time zone" />
                    <Annotation Term="Microsoft.Dynamics.OData.Core.V1.AXType">
                        <EnumMember>Microsoft.Dynamics.OData.Core.V1.AXType/Enum</EnumMember>
                    </Annotation>
 </Property>
Now, there is a EnumType defined with TimeZone as follows which has many entries, for ex. an entry for Hawaii is as follows:
<EnumType Name="Timezone">
.....
<Member Name="GMTMINUS1000HAWAII" Value="39">
          <Annotation Term="Microsoft.Dynamics.OData.Core.V1.LabelId" String="(GMT-10:00) Hawaii" />
     </Member>
....
</EnumType>
Currently, a SystemUser has PreferredTimeZone set as follows:
{
"PreferredTimeZone""GMT_COORDINATEDUNIVERSALTIME"
}
I want to change this, how should I do go about doing this? I have tried following things, please let me know
where am I going wrong and what are the things that I am missing to understand?
Here are my different attempts in changing the preferred time zone to GMTMINUS1000HAWAII
Request Type: PATCH, URL: https://<fo-base-url>/data/SystemUsers('NeerajUser2')
{
"UserID""NeerajUser2",
    "PreferredTimeZone" : "GMTMINUS1000HAWAII"
} ----> Get 204 status but the value is not updated
{
"UserID""NeerajUser2",
    "PreferredTimeZone" : "39"
} ----> Get 204 status but the value is not updated
{
"UserID""NeerajUser2",
    "PreferredTimeZone" : 39
} ----> Fails with "message""Cannot read the value '39' as a quoted JSON string value.",
{
"UserID""NeerajUser2",
    "PreferredTimeZone" : "Microsoft.Dynamics.DataEntities.Timezone'GMTMINUS1000HAWAII'"
} // Fails with: Requested value 'Microsoft.Dynamics.DataEntities.Timezone'GMTMINUS1000HAWAII'' was not found
{
"UserID""NeerajUser2",
    "PreferredTimeZone" : "Microsoft.Dynamics.DataEntities.Timezone'39'"
} // Fails with: Requested value 'Microsoft.Dynamics.DataEntities.Timezone'39'' was not found
I have tried various other combinations but not able to achieve what I want to do!
How do I verify if the value is updated? System Administration > Users > Select User > User Options > Preferences > Time zone
Question 2: There is other property "StartPage" which also seems to be an Enum and is defined as follows in the DataEntity:
(also, there are other properties defined similarly, taking "startpage" as an example)
<Property Name="StartPage" Type="Edm.String">
     <Annotation Term="Microsoft.Dynamics.OData.Core.V1.AXType">
          <EnumMember>Microsoft.Dynamics.OData.Core.V1.AXType/String</EnumMember>
     </Annotation>
 </Property>
But I am not able to see what are the values defined for this anywhere. How to check those?
Question 3:
How to get what are the values currently defined for the EnumType before updating them to avoid unnecessary errors?
For Ex: how to get (using Odata) the entries defined in the EnumType: Timezone before triggering the request to update
the Enum property of a DataEntity so that wrong values are not sent to avoid failure and retries.
Same for StartPage as well!
Thanks in advance.
Regards,
Neeraj
I have the same question (0)
  • ToddB Profile Picture
    on at

    Hi Neeraj,

    I found the below thread:

    D365 Finance and operations odata for enums

    community.dynamics.com/.../d365-finance-and-operations-odata-for-enums

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans