CRM Many to Many - Duplicate Record Error RRS feed

  • Question

  • Hi,

    I have trouble in CRM 2013. We have this mofication in CRM:

    Account Entity has Many To Many relationship on Custom Entity with name Project.

    Project has two lookup fields on Account Entity.

    I have plugin on Create Message of Project Entity. It makes automatically new record in many to many relationship between Account and Project. It works fine when I create Project from main menu. When I create Project from Account form where is grid on many to many records, then CRM creates many to many relationship automatically and CRM shows error "Duplicate Record".

    Could you help me with trhis error?

    Exception when executing non-query: insert into [cdl_accountsBase]([cdl_projectid], [accountid], [cdl_accountsId]) values ('57672841-71fc-e311-93f7-0050568c3115', '85bb3fed-12e7-e311-93f4-0050568c3115', '6d672841-71fc-e311-93f7-0050568c3115') Exception: System.Data.SqlClient.SqlException (0x80131904): Cannot insert duplicate key row in object 'dbo.cdl_accountsBase' with unique index 'ndx_cdl_accounts'.

    Message: There is no entity map defined for the given entities, ErrorCode: -2147217919

    Thursday, June 26, 2014 7:02 AM

All replies

  • can you please check definition of index "ndx_cdl_accounts", is this custom index or out of box index? 

    if it is custom index then you need to make sure either index is correct or your operations are validated before creating new project on account.

    My Blog
    Follow Me on Twitter

    Thursday, June 26, 2014 9:48 AM
  • Index ndx_cdl_accounts is created by CRM. I create "many to many" realtionship between entity account and entity project. Then i create two Account lookup fields at entity Project.
    Thursday, June 26, 2014 5:44 PM