Data migration number sequence

Hi,

Im getting the below error while importing customer contacts through DIEF in AX2012.

"Error occurred while doing bulk copy from temp table to entity table-Violation of PRIMARY KEY constraint ‘I_102417CONTACTPERSONID’. Cannot insert duplicate key in object "

In my CSV file empty value is given in ContactPersonId field. The contactPersonId has to generated through the number sequence.I have written the number sequence generation logic in the generate method in DMF class.It works fine when I try to import a single record. But it is throwing the above error while trying to insert more than one record .

Please guide.

Thanks & Regards,

Chutti

Where is the error thrown from? Knowing that will help with debugging, if nothing else.

Have you verified in debugger that contact person IDs are generated correctly when importing multiple customers? If not, your own code (unknown to us) is likely to blame.

Hi Drab,

Hi Drab,

when i try to insert multiple records it is not inserting in staging table itself …It is throwing the error while inserting in staging table.

I have written code to generate number sequence while insert in target .It is working fine for single record.When It comes to multiple records it is not inserting in staging table itself so Im not able to check with this code

Your code doesn’t to anything when inserting records to the staging table; it uses number sequence only when moving to target (_stagingToTarget is true).

The problem is that ContactPersonId is the primary key of DMFContactPersonEntity table, therefore you’re not allowed to save two records with the same ID / without any ID. You’ll have to generate IDs before saving to the staging table.

If you debugged your code, you would see that it does nothing. It would have saved your time (and my time too).