Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 143529

Enum problems in D365FO when creating custom services

$
0
0

I’ve come across an interesting problem. It is about how D365FO handles enums in custom web services that are set IsExtensible=True

To illustrate, I’ve created the following example – new enum, firstly with IsExtensible=False

 When selecting enum values, properties are fine and web service wsdl looks fine and the field and enum can be used normally when calling it in a c# project.

But when IsExtensible is set to True, it no longer behaves normally, some properties disappear from the enum values.

Also in the wsdl it is now included as a string and as such must be filled in when calling from c#.

 

That itself might not be a huge problem, but here comes the thing I’m not sure how to resolve.

When passing a string field in the enum field and calling the web service, a .net deserialization error is thrown.

  

Google tells me that when creating and using enums in c#, the values available in the data contracts need to be marked with the EnumMemberAttribute.

https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/enumeration-types-in-data-contracts

But I’m not sure how I can do this with the D365FO enum. Is there a way how to add attributes to D365FO  enums?

Also I can’t modify the enum as actually the enum I need is LedgerJournalACType, which I can’t customize because it is in the ApplicationPlatform model.

Obviously one workaround would be to create an enum of my own with the same values and do a switch to map between my new enum and LedgerJournalACType values. But I’d rather not do that if there is a way of avoiding it and doing it properly by using the correct enum…..


Viewing all articles
Browse latest Browse all 143529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>