Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Is there an (efficient) way to delete entity references in batch API

Posted on by Microsoft Employee

I'm new to Microsoft dynamics web API and I need to remove/null an entity reference (a field holding a GUID which is an ID of a record in another entity) in a batch update call. This batch update call could contain any number of records and each record could contain any number of entity reference fields that need to be nulled. To set an entity reference, I'm able to do the following:

"gnh_address1_countryid@odata.bind":"/gnh_countries(c58790c2-ed83-e511-80f7-1458d043a570)"

However, to remove this, setting the value to null (or an empty GUID string of 0s) does not seem to work. I've come across this page

https://msdn.microsoft.com/en-us/library/mt607875.aspx#bkmk_Removeareferencetoanentity

which tells me that I need to do a delete call for a given field that I want to remove. Is this really the only way of doing it? That seems to me to be a lot of calls to what should be a fairly simple thing to do. What I understand the article to be saying is, if I had 3 records that I wanted to update, each of which had 3 entity reference fields that I wanted to delete/nullify, that would be 1 call for the batch update, and then 9 subsequent delete calls. If I had 1000 records to update, this would be an update and then 3000 delete calls. Again, is this really the only way of doing it? Is there no way to remove them as part of the batch update?

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Is there an (efficient) way to delete entity references in batch API

    @NHogeboom, I am facing the same problem. I have to make 10 different calls to crm to remove my entity references. And as you mentioned I am using update to make the field null, but this doesnot work. Have you found the answer to this problem? Any help is appreciated.

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!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans