Developer forum

Forum » Development » Orderstate workflow gives error when changing state

Orderstate workflow gives error when changing state

Martin Nielsen
Reply

Hi DW,

 

I've setup a workflow for my ordersteps, so that one of them sends an e-mail to the customer.

My problem is that on some orders i get this error when i change the orderstep to the one that sends the e-mail:

 

Server Error in '/' Application.
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   Dynamicweb.eCommerce.Frontend.Renderer.RenderUserAddresses(Order Order, Template Template) +1062
   Dynamicweb.eCommerce.Frontend.Renderer.RenderOrderDetails(Template template, Order order, Boolean extendedProperties, OrderContext OrderContext) +3409
   Dynamicweb.eCommerce.Frontend.Renderer.RenderOrder(Order Order, Template Template, Boolean ExtendedProperties, Int32 stepReq, OrderContext OrderContext) +57
   Dynamicweb.eCommerce.Orders.Order.SendTo(PageView& PageView, String subject, String ToMailAddress, String FromMailAddress, String FromMailName, Template& MailTemplate) +79
   Dynamicweb.eCommerce.Orders.Order.Save(String IDStr, Boolean saveOldVersion) +4950
   Dynamicweb.Admin.eComBackend.EcomOrderEdit.DoSave() +1403
   Dynamicweb.Admin.eComBackend.EcomOrderEdit.Ribbon_SaveAndClose(Object sender, EventArgs e) +17
   Dynamicweb.Controls.RibbonBarButton.RaisePostBackEvent(String eventArgument) +33
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9642898
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1724


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18033 

Does anyone have an idea to what could be wrong?

 

// Martin

 


Replies

 
Morten Bengtson
Reply

Hi Martin,

Make sure you pass on an instance of PageView when you initialize the Renderer...

var pageView = Dynamicweb.Frontend.PageView.Current() ?? Dynamicweb.Frontend.PageView.GetPageview();
var renderer = new Dynamicweb.eCommerce.Frontend.Renderer(pageView);

 

 
Martin Nielsen
Reply

Hi Morten,

 

I'm using the standard DW feature for this . So i'm not passing anything along myself.

 

 

// Martin

 
Jeppe Eriksson Agger Dynamicweb Employee
Jeppe Eriksson Agger
Reply

Hi Martin,

 

Which version of Dynamicweb are you using? There were some issues like this after the "Multiple Addresses" feature was added to User Management in 8.1.2. I would suggest upgrading to a later version like 8.1.3 or 8.2.

 

Please let me know if this does not solve your problem.

 

- Jeppe

 

You must be logged in to post in the forum