Error Saving Order via API

Discussions related to SoftPro Select Server development.

Moderator: Phil Barton

Post Reply
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Error Saving Order via API

Post by roteague »

I'm running into an issue where I am opening up an order via the API, updating a custom field in the order, then saving the order. I'm getting a validation message that says "Error: Object reference not set to an instance of an object". It's happening on the same Custom Field "TGExpressId_150003#"; it's a simple Text type, of 150 characters, Active and Hidden. Any suggestions?
Robert
Mark McKenna

Re: Error Saving Order via API

Post by Mark McKenna »

Hi Robert,
Do you have a stack trace? I would expect there to be an error reported in the Windows event viewer, complete with a stack trace. Also, was this custom field defined on the Order context type?
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Error Saving Order via API

Post by roteague »

Unfortunately, there is no event log, so I don't have a stack trace. All I have is a validation message. The Custom Field is on the Order object, and was create by SoftPro for us.
Robert
Mark McKenna

Re: Error Saving Order via API

Post by Mark McKenna »

If you change the definition to not be hidden using SPAdmin, are you able to open the order in question, set the value to whatever it is you are trying to set it to, and save the order ... all from within the Select app (not using the API)?
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Error Saving Order via API

Post by roteague »

I changed the definition on a couple of fields, to IsHidden = 0. One of the fields started updating, but the other exhibits the same error message. I'll have to monitor it for a while to see if the first field continues to update.

Thanks Mark,
Robert
Mark McKenna

Re: Error Saving Order via API

Post by Mark McKenna »

If you're doing this directly in the database, which appears to be the case, carefully compare the 2 definitions for any discrepancies. If you have one field that is working fine, and another that is not, look closely at the two definitions - ideally find two definitions that are close in functionality (text string data on the same object context, for example).
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Error Saving Order via API

Post by roteague »

It looks like both are working fine now. Thanks for the help, I'll have to remember to make sure the fields I need to update aren't marked as hidden.
Robert
Mark McKenna

Re: Error Saving Order via API

Post by Mark McKenna »

Robert, thanks for verifying offline for us that the problem does not appear to be directly related to the Hidden setting of the custom field. Nonetheless, you still have an issue which we can resume looking at. What version of Select is this happening with?
roteague
Posts: 292
Joined: Thu Sep 25, 2008 4:49 pm
Location: Honolulu, Hawaii

Re: Error Saving Order via API

Post by roteague »

We are running 2.6 SP4.
Robert
Mark McKenna

Re: Error Saving Order via API

Post by Mark McKenna »

Ah, then perhaps what you're seeing is related to the API Ledger save problem that occurs (only) in 2.6 SP4. The Ledger object may be getting saved automatically due to changes in the Order that cause it to become "dirty".

See: viewtopic.php?f=6&t=219

SP5 is available now. which fixes the Ledger save issue. I'd recommend installing that version - and let us know if the problem still persists.
Post Reply