Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Can not delete Custom Entities and it's not about dependencies

(0) ShareShare
ReportReport
Posted on by 85

Hi there. I created a fresh new entity which has no additional fields or relations to anything and also without any records.

Just after i created the entity and when i try to delete it, it gives me the following error:

An error has occurred.

And in the log file which can be downloaded from the error dialog:

System.ArgumentNullException: Value cannot be null. Parameter name: collection

And when enabled tracing the error was:

Process: w3wp |Organization:0220cef0-4f09-e711-80d8-000c2950db72 |Thread:  244 |Category: Platform.Metadata |User: 00000000-0000-0000-0000-000000000000 |Level: Error |ReqId: 17d8623e-7539-48af-9652-b8550acfb76f | EntityService.Delete  ilOffset = 0x1A8
>EntityService.Update caught exception: System.ArgumentNullException: Value cannot be null.
Parameter name: collection
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at Microsoft.Crm.BusinessEntities.CascadeEngine.LogRecordSetCount(Int32 count, IEnumerable`1 entityIds, Int32 parentEntityObjectTypeCode, String perfCounterName)
   at Microsoft.Crm.BusinessEntities.CascadeEngine.CascadeDeleteDB(IEnumerable`1 parentEntityIds, Int32 parentEntityObjectTypeCode, ExecutionContext context)
   at Microsoft.Crm.BusinessEntities.CascadeEngine.Delete(IEnumerable`1 entityIds, Int32 entityObjectTypeCode, ExecutionContext context)
   at Microsoft.Crm.BusinessEntities.CascadeEngine.DeleteAll(Int32 entityObjectTypeCode, ExecutionContext context)
   at Microsoft.Crm.Metadata.EntityService.Delete(Guid entityId, MetadataHelper metadataHelper, Boolean suppressSecurityCacheFlush, ExecutionContext context)

Well i don't know whats wrong. Please let me know if you know anything. Thanks.

*This post is locked for comments

  • Verified answer
    H J Shakib Profile Picture
    H J Shakib 85 on at
    RE: Can not delete Custom Entities and it's not about dependencies

    I did noticed something that this error only happens when Persian language pack is installed, but when its just CRM with no language packs everything is fine.

    So at least i know what to do now.

    Thanks for all of your answers specially @Pranav Shroti, and sorry that the solution isn't something useful to all of community.

  • H J Shakib Profile Picture
    H J Shakib 85 on at
    RE: Can not delete Custom Entities and it's not about dependencies

    @Pranav Shroti , Unfortunately couldn't deleted it programmatically either, it throws "An unexpected error occurred."

    And about Sql trace i done it already but couldn't get any sense of it, i mean no error or anything was there, just normal select and execute.

    Don't know man really stucked :(

  • H J Shakib Profile Picture
    H J Shakib 85 on at
    RE: Can not delete Custom Entities and it's not about dependencies

    @Aric Levin, I checked all dependencies by "Show Dependencies" button, and all dependencies is some sort of systematic, like business_unit relation, System Jobs, Bulk Delete and ... also its edit forms is disabled and can't be edited.

    depend.jpg

    Also as i mentioned before i just created the entity and it has no record or data, and it's not about this entity but all new entities which i created can't be deleted!

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Can not delete Custom Entities and it's not about dependencies

    I think its a dependency issue , a value as been inserted into this entity which is been referenced in another entity that's why it specifying Value cannot be null.

  • PranavShroti Profile Picture
    PranavShroti 4,510 on at
    RE: Can not delete Custom Entities and it's not about dependencies

    Few things to check:

    1. Run a SQL trace to find out the cause - it could be that there is a custom index that has been added that is preventing delete.

    2. Pragmatically delete entity using following code:

    DeleteEntityRequest request = new DeleteEntityRequest()

    {

    LogicalName = _customEntityName,

    };

    _serviceProxy.Execute(request);

    if none of the above works then I believe ticket with MS is our final option.

    Regards,

    Pranav

  • Aric Levin Profile Picture
    Aric Levin 30,188 on at
    RE: Can not delete Custom Entities and it's not about dependencies

    I would check the cascading rules for the relationship that are related to this entity?

    Does this entity have any data.

    Try deleting the data for the entity before deleting the entity (per message).

  • ashlega Profile Picture
    ashlega 34,477 on at
    RE: Can not delete Custom Entities and it's not about dependencies

    I think this is worth opening a ticket with Microsoft..

  • H J Shakib Profile Picture
    H J Shakib 85 on at
    RE: Can not delete Custom Entities and it's not about relations

    I read this links but i don't think it's a dependency problem.

    All of errors about dependency is shown before this error and i resolved it.

    As i mentioned in my question i also created a fresh new test entity and no different, all of new entities and existed entities with no dependencies shows me this error when i try to delete them.

  • H J Shakib Profile Picture
    H J Shakib 85 on at
    RE: Can not delete Custom Entities and it's not about relations

    Do you happen to know any c# sample code to delete the entity itself and not it's records?

    I googled and all is about how to deleting the records of an entity.

  • PranavShroti Profile Picture
    PranavShroti 4,510 on at

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,494 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,305 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans