locked
Assign account throws CrmException: "All entities must be found." RRS feed

  • Question

  • After updating to rollup 11, we get the following error in the trace logs when trying to assign a user to an account (In CRM it just shows you the generic "try again" error message).

    Stack Trace Info: [CrmException: All entities must be found.]
    at Microsoft.Crm.CrmException.Assert(Boolean condition, String message)
    at Microsoft.Crm.BusinessEntities.CascadeBulkEntityRetriever.Retrieve(String tempTableName, IColumnSetProvider columnSetProvider, ExecutionContext context)

    Running an SQL trace doesn't really provide any further clues: I can see that the stored procedure p_CascadeCollectAssign is used to fill a temporary table #CascadeCollectAssign and the error occurs around that time, but the SQL seems to be executed correctly so I don't know where it's actually failing. I think it has something to do with certain entities linked to the accounts, as reassigning accounts with few linked entities does seem to work...

    Monday, July 19, 2010 9:48 AM

Answers

  • Hello Aykin,

    Try this step first.

    1. Open the account you are unable to assign and click Contacts on the left-hand side.
    2. Open the contact record listed.
    3. Clear the Parent Customer field and click Save and Close.
    4. Go to Actions > Assign, and reassign the record.
    5. Click Contacts on the left-hand side again, and click Add Existing Contact.
    6. Add the contact from step 2 back to the account, and Save and Close the record.

    If that works, it may mean that your data is the following situation: AccountId and ContactId values were populated in the LeadBase table, which is invalid. This makes the CustomerId lookup attribute contain two records, when lookups can only contain one.  One of the records will have to be set to NULL.

    Please have good backups before you do any direct SQL updates.


    Best regards,

    Don Chang
    Partner Online Technical Community
    -----------------------------------------------------------------------------------------
    We hope you get value from our new forums platform! Tell us what you think:
    http://social.microsoft.com/Forums/en-US/partnerfdbk/threads
    ------------------------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, July 21, 2010 8:24 PM
    Moderator

All replies

  • Hello Aykin,

    Try this step first.

    1. Open the account you are unable to assign and click Contacts on the left-hand side.
    2. Open the contact record listed.
    3. Clear the Parent Customer field and click Save and Close.
    4. Go to Actions > Assign, and reassign the record.
    5. Click Contacts on the left-hand side again, and click Add Existing Contact.
    6. Add the contact from step 2 back to the account, and Save and Close the record.

    If that works, it may mean that your data is the following situation: AccountId and ContactId values were populated in the LeadBase table, which is invalid. This makes the CustomerId lookup attribute contain two records, when lookups can only contain one.  One of the records will have to be set to NULL.

    Please have good backups before you do any direct SQL updates.


    Best regards,

    Don Chang
    Partner Online Technical Community
    -----------------------------------------------------------------------------------------
    We hope you get value from our new forums platform! Tell us what you think:
    http://social.microsoft.com/Forums/en-US/partnerfdbk/threads
    ------------------------------------------------------------------------------------------
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, July 21, 2010 8:24 PM
    Moderator
  • Thanks Don, clearing the Parent Customer fields of the related contacts did allow me to reassign the record. I'll try and verify the CustomerID later on.
    Wednesday, July 21, 2010 9:02 PM
  • Don,

     

    I've checked the ContactBase records in question (I think you meant those instead of LeadBase records?) but only the AccountID contains a value. What's odd is that I used a workflow to clear and enter the accountid in the (ten) related Contacts, but the workflow fails on some of them when trying to enter the accountid again (I had to enter the account manually for them, which did work). The error the workflows throw is the following:

    >CrmSoapExtension detected CrmException:
    System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.SqlClient.SqlException: Transaction (Process ID 113) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.
    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
    ...
    at Microsoft.Crm.CrmDbConnection.ExecuteNonQuery(IDbCommand command, Boolean impersonate)
    at Microsoft.Crm.CrmDbConnection.ExecuteNonQuery(IDbCommand command)
    at Microsoft.Crm.BusinessEntities.PrincipalObjectAccessHelper.GrantInheritedAccess(Guid referencingId, Int32 referencingOTC, Guid referencedId, Int32 referencedOTC, Guid referencingOwnerId, Guid referencedOwnerId, ExecutionContext context)
    at Microsoft.Crm.BusinessEntities.CascadeEngine.CascadeReparent(Guid parentEntityId, Int32 parentEntityObjectTypeCode, Guid parentOwnerId, ExecutionContext context, Boolean unshare)

    From what I can see in the SQL trace, I think it fails on the "UPDATE PrincipalObjectAccess SET InheritedAccessRightsMask = 0" with the ObjectID = ContactID in question although I can't be sure (it seems to be the only update related to those records at least). There are relatively few PrincipalObjectAccess records (only about 60.000) and the Contacts aren't being shared...

    Thursday, July 22, 2010 7:45 AM
  • This issue seems to occur with every account that has contacts so it's a major problem, and constantly reassigning the contacts isn't exactly an option. I still can't find the exact source of the problem though. Dbo.p_CascadeCollectAssign is definitely present so that's not the cause of the issue...

    Monday, August 30, 2010 12:44 PM
  • Is it possible that the data was originally imported using an unsupported method? 

    Regards, Donna

    Wednesday, September 1, 2010 6:19 PM