Proplem
When creating Virtual Entities in Dynamics 365 (using the Odata v4 Provider)
According to MS documentation OptionSet fields cannot be mapped using Int and that enum should be used:
Below an example of an odata $metadata: Note statusCode uses enum ak_iglead_StatusCode and the values are string (although the source has them defined as int)
When Dynamics does an update to this Virtual Entity it seems that its posting the optionsetvalue on the form as int ( as it was mapped - I mean how else (only int values are used for an optionsetvalue)
The result from the logstream shows that the json was malformed :
More Information:
The request could not be understood by the server due to malformed syntax.IE, in postman I was expecting Dynamics to do this (and works):
BUT it did this (because of the mapping, I guess?)
fiddler also confirms that the body send was:
{"ak_leadstatus":821220012}
Question
would the simplest fix be to get the **enum** values to also display as int values in $metadata? and how does one do that -is there some decoration I need on the PATCH? Or how else is an update handled using **enums**or how do I get the PATCH body to do this :
{
"@odata.context": "http://localhost:57838/$metadata#ak_igLeads(ak_Lead_StatusCode)/$entity",
"statusCode@odata.type" : "#AK.IG.VirtualEntity.DataSource.Models.ak_iglead_StatusCode"**,
"statusCode" : "New"
}