Getting an exception trying to save an order. SQL Error

Discussions related to custom development with Select.
Post Reply
merak.marey
Posts: 14
Joined: Fri Oct 30, 2020 10:41 am

Getting an exception trying to save an order. SQL Error

Post by merak.marey »

Hi

I'm getting an exception trying to save an order.
sp-exception.jpg
sp-exception.jpg (68.75 KiB) Viewed 856 times
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

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

Post by BobRichards »

Sorry but we cannot fix this issue in the DevForum. Please contact SoftPro customer support for assistance.
Bob Richards, Senior Software Developer, SoftPro
merak.marey
Posts: 14
Joined: Fri Oct 30, 2020 10:41 am

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

Post 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 827 times
BobRichards
Posts: 1376
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

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

Post 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.
Bob Richards, Senior Software Developer, SoftPro
Post Reply