I'm trying to update an Account record using the Force.com Toolkit for .NET. The Account record has custom fields.

I thought the toolkit allowed the [DataMember] attribute to be used, but its not working for me.

Is there any way to specify the custom field name to be used (namespace__Field_Name__c) without having to name my class property that?


There was a Pull request to add this functionality Support for DataMember attributes #126. It was merged in on the 25th of August 2015 to be in the next NuGet release.

From Nuget this should correspond with v1.1.1 onward.

In terms of source code, I can see references to DataMemberAttribute in ModelDescriptionGenerator.GetMemberName. Note that in that method a JsonPropertyAttribute will take precedence to the DataMemberAttribute.

| improve this answer | |
  • I'm using 1.1.1, and yes I saw those references in the code as well, and yet it appears to be ignoring the attributes - at least for the CreateAsync method. – Dale K Feb 3 '16 at 19:23
  • Are you also using the JsonProperty attributes? It might be easiest to diagnose by pulling down the source and stepping through it. – Daniel Ballinger Feb 3 '16 at 19:33
  • Well the JsonProperty attribute works for me, but the DataMember attribute doesn't - however thats not your problem, so I accept your answer. Thanks. – Dale K Feb 4 '16 at 22:44
  • Maybe raise it as an issue on the Github project. Someone there will be well setup to trace the issue. – Daniel Ballinger Feb 4 '16 at 23:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.