Hi Bob
After further research found that this error is related to the setting of the contact.
The charge in question is a DueFromBuyerSummaryCharge (CDF Page 3, Section K, Line 4) which is being populated.
If I try to set the Contact property of the Charge, it will produce the error message shown on the image, which is as follow
-------------- QUOTE --------------------------
Process exception:Violation of PRIMARY KEY constraint 'PK_Entity'.
Cannot insert duplicate key in object 'pfm.Entity'. The duplicate key value is (-2146907990, -1878422464). Violation of PRIMARY KEY constraint 'PK_CDFCharge'.
Cannot insert duplicate key in object 'pfm.CDFCharge'. The duplicate key value is (-2146907990, -1878422464). Violation of PRIMARY KEY constraint 'PK_Entity'.
Cannot insert duplicate key in object 'pfm.Entity'. The duplicate key value is (-2146907990, -1878422463). Violation of PRIMARY KEY constraint 'PK_CDFChargeCalculation'.
Cannot insert duplicate key in object 'pfm.CDFChargeCalculation'. The duplicate key value is (-2146907990, -1878422463). Violation of PRIMARY KEY constraint 'PK_Entity'.
Cannot insert duplicate key in object 'pfm.Entity'. The duplicate key value is (-2146907990, -1878422462). Violation of PRIMARY KEY constraint 'PK_IndividualStatementContact'.
Cannot insert duplicate key in object 'pfm.IndividualStatementContact'. The duplicate key value is (-2146907990, -1878422462).
The statement has been terminated.
------------------- END QUOTE ------
Here's the code
var Contact = GetContact(); // This will iteract on Order.Contacts and will return a contact with code "P"
Charge.Contact= Contact
Charge is dynamic, representing the charge @ K.04.01
Below a screenshot of the state of the charge before updating.
Again, the exception is thrown when trying to os.ApplyChanges((IOrder)order);
- k0401.jpg (311.67 KiB) Viewed 1038 times