Developer forum

Forum » Integration » Changing OrderState

Changing OrderState

Casper Andersen
Reply

Hi DynamicWeb

in my custom destination provider.

I at some point need to change the orderstate of an order.

for that i use this code

Dynamicweb.eCommerce.Orders.Order order = Dynamicweb.eCommerce.Orders.Order.GetOrderByID(ord.OrderID);
string ordsid = order.OrderState.ID = Helper.GetOrderState(op.op_level);
order.StateID = ordsid;
order.Save(order.ID);

I tested it many times on localhost enviroment without any problems. But when i put this live it throws any error.

Localhost version of DW is 8.9.0.0 and live version is 8.6.1.16

Dont know if this has any influence on this?


Replies

 
Nicolai Pedersen
Reply

Hi Casper

What is the error?

BR Nicolai

 
Casper Andersen
Reply

The error i get is:

Object reference not set to an instance of an object.

Its trying to pass OS11 as the OrderState ID which is the default one anyway

Edit (its the default one in my solution that is)

 
Nicolai Pedersen
Reply
This post has been marked as an answer

Hi Casper

Make sure both installations use the same version and the same data - and add a debugger.

Votes for this answer: 1
 
Casper Andersen
Reply

Dont know why i did not think about this earlier, but upgrading the live site to the recommended version solved my problem.

 

You must be logged in to post in the forum