API Support Forum
OEC API > Advanced Order Management > Order Draft - Primary Key
Author Topic: Order Draft - Primary Key
(3 messages, Page 1 of 1)
Moderators: VPfau
WBetts
Posts: 19
Joined: May 29, 2008


Posted: Jun 04, 2008 @ 07:16 AM             Msg. 1 of 3
I would like to include the primary key from my database with an OrderDraft.
Then when the order is confirmed I can grab that key and update my database with the appropriate information (order #, timestamp, etc.).

Are there any custom properties of an OrderDraft I can update and later retrieve from the OnOrderConfirmed method?

If not, is there another way I can accomplish this efficiently? I'd rather not have to iterate all open/working orders if possible.

Thanks,
-TraderBetts
SergeK
-Developer-
Posts: 475
Joined: Jan 26, 2007


Posted: Jun 04, 2008 @ 08:54 AM             Msg. 2 of 3
OrderDraft doesn't have ID field, and there is no way to uniquely associate an OrderDraft with an Order.

However, when you call SendOrder, it returns an Order object with Order.ID set to local temporary ID (usually negative numbers starting from -1). This could be stored along the order information.

Once order is confirmed by server, Order.ID is assigned by system unique ID, and event OnOrderConfirmed is called with the temporary ID passed as a second parameter - so you could update database with actual order id there.
WBetts
Posts: 19
Joined: May 29, 2008


Posted: Jun 04, 2008 @ 10:24 AM             Msg. 3 of 3
I see the OldOrderID being passed to OnOrderConfirmed. I think that will do the trick for me.
Thanks Serge.