Page 1 of 1

Getting an exception trying to save an order. SQL Error

Posted: Tue Apr 27, 2021 12:02 pm
by merak.marey
Hi

I'm getting an exception trying to save an order.
sp-exception.jpg
sp-exception.jpg (68.75 KiB) Viewed 1094 times

Re: Getting an exception trying to save an order. SQL Error

Posted: Tue Apr 27, 2021 2:04 pm
by BobRichards
Sorry but we cannot fix this issue in the DevForum. Please contact SoftPro customer support for assistance.

Re: Getting an exception trying to save an order. SQL Error

Posted: Tue May 11, 2021 2:08 am
by merak.marey
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
k0401.jpg (311.67 KiB) Viewed 1065 times

Re: Getting an exception trying to save an order. SQL Error

Posted: Tue May 11, 2021 7:31 am
by BobRichards
You will still need to contact SoftPro Customer Support to resolve the underlying issue. Sorry. They will be able to escalate you to a group that can help with the underlying SQL issue.