locked
Generic SQL Error in Account Merge RRS feed

  • Question

  • I am getting Generic SQL error while merging accounts using SDK in CRM 2011. This is happening only in PROD environment for only few records,  I am not sure what is happening in the background.  as I don't have DBA access to SQL server so I did not try enabling SQL profiler. I am not able to replicate the same in other environments like DEV and QA, It is working fine all other environment except PROD, I would appreciate if you guys have any idea that will help me. Thanks in advance.

    Wednesday, December 4, 2013 5:34 PM

Answers

  • If SubOrdinate or Master account contacts/sub accounts are already shared with Master account owner, it creates a record in POA table. when merging accounts, it will again try to create the same record in POA table,  since this record already exists in POA table which causes Generic SQL Problem(Violation of UNIQUE KEY constraint 'UQ_PrincipalObjectAccess'. Cannot insert duplicate key in object 'dbo.PrincipalObjectAccess'), I would say this is actually CRM bug.

    Following solution will help you to resolve this problem.

    I would suggest before executing MergeRequest, try changing MasterAccount owner to Organization Service user whoever executing the MergeRequest and then do Merge, make sure user should have sufficient Merge privileges.

    After Merge, you can update the MasterAccount owner back to Orginal owner.

    • Marked as answer by VSomireddy Tuesday, December 10, 2013 5:19 PM
    Tuesday, December 10, 2013 4:53 PM

All replies

  • Hello,

    In case you have not access to SQL you should initially look on CRM Trace. Here is an article that describes how to turn on CRM Tracing.


    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Wednesday, December 4, 2013 6:44 PM
    Moderator
  • Unfortunately I don't have access to PROD servers to enable CRM Tracing. Let me know if there is any other way to find out what is wrong?
    Wednesday, December 4, 2013 7:27 PM
  • Unfortunately there is no other way to get info what's wrong.

    Dynamics CRM MVP/ Technical Evangelist at SlickData LLC
    My blog

    Wednesday, December 4, 2013 7:59 PM
    Moderator
  • Thanks Andrii, I know there is no other way to troubleshoot this error.

    Finally I could simulate the same in QA environment, turned on SQL profiler and got the below error message. please let me know what fix I could do to resolve this issue when doing merge.

    Violation of UNIQUE KEY constraint 'UQ_PrincipalObjectAccess'. Cannot insert duplicate key in object 'dbo.PrincipalObjectAccess'.

    Thursday, December 5, 2013 4:05 PM
  • If SubOrdinate or Master account contacts/sub accounts are already shared with Master account owner, it creates a record in POA table. when merging accounts, it will again try to create the same record in POA table,  since this record already exists in POA table which causes Generic SQL Problem(Violation of UNIQUE KEY constraint 'UQ_PrincipalObjectAccess'. Cannot insert duplicate key in object 'dbo.PrincipalObjectAccess'), I would say this is actually CRM bug.

    Following solution will help you to resolve this problem.

    I would suggest before executing MergeRequest, try changing MasterAccount owner to Organization Service user whoever executing the MergeRequest and then do Merge, make sure user should have sufficient Merge privileges.

    After Merge, you can update the MasterAccount owner back to Orginal owner.

    • Marked as answer by VSomireddy Tuesday, December 10, 2013 5:19 PM
    Tuesday, December 10, 2013 4:53 PM