Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

WEBAPI Syntax for updating CRM2016

Posted on by 924

Web API might be the next big thing for developers, but it needs some serious work to remove some of the time wasting traits it currently has.

I've been trying to use the Web API to update properties in CRM where I couldn't use a traditional C#/SDK wrapper, and have struggled with syntax despite using the JObject helper class.  Here are some of the issues developers need to be aware of.

1. table name need to have 's' to make them plural, if they already have 's' then its 'es'. What's wrong with sticking to the published schema name?

2. Updating traditional fields on an entity, you need to use the lowercase version the fields, but if its a lookup to another entity then its the *schema* name. This inconstancy means people following examples online are likely to fall foul of this as no online examples I've seen involve lookup.

3. You can remove a field value using JObject by setting the field to NULL. However, this does not work when its a lookup field that you now no longer need (e.g. many-to-one). It seems that an elaborate disassociate structure is needed that cannot be done within the same update message. What we ended up doing was making a lookup we don't need GUID.Empty and then using the PlugIn to spot the value and substituting it to a NULL EntityReference. This is a fudge and shouldn't be needed, but at least it works.

Does anybody know where there is a resource of documentation with proper real-world examples of all features with or without the JObject support? As this would have helped me. The discrepancies between name and schema name was big time waster as none of the ms examples dealt with lookups.

I guess one thing to remember... If you can't get Web API to dealt what you need efficiently, at least you can pass a message in and pick it up in a plug-in for processing with full sdk support.

I hope this helps other newbies to this technology.

Steve

*This post is locked for comments

  • HenriL Profile Picture
    HenriL 485 on at
    RE: WEBAPI Syntax for updating CRM2016

    +1 for the inconsistencies. Spent lots of time just to figure out the right syntax, case sensitivity, etc.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans