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