Developer forum

Forum » Ecommerce - Standard features » Place recurring orders tasks failing - takes carts into account?

Place recurring orders tasks failing - takes carts into account?

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

In one of my solutions, the Place Recurring Orders scheduled task shows a red exclamation mark indicating an error. The logs show this:

2022-10-12 13:00:23.6532|INFO|ScheduledTasks|Task 'Place recurring orders' with ID '7' execution is started
2022-10-12 13:00:23.6532|INFO|ScheduledTasks|Task 'Place recurring orders' ID=7: task execution started
2022-10-12 13:00:23.6532|INFO|ScheduledTasks|Task 'Place recurring orders' ID=7: Method Dynamicweb.Scheduling.Providers.RecurringOrdersScheduledTaskAddIn.RecurringOrdersScheduledTaskAddIn.Run returned: False
2022-10-12 13:00:23.6532|INFO|ScheduledTasks|Task 'Place recurring orders' ID=7: task execution finished

which led me to this code in the task:

foreach (RecurringOrder recurring in RecurringOrder.GetRecurringOrdersForScheduling())
{
    try
    {
        Order order = Ecommerce.Services.Orders.GetById(recurring.BaseOrderId);
        if (order is object)
        {
          ...
        }
        else
        {
            result = false;
        }
    }
    catch (Exception)
    {
        //Logger.LogGeneral("Recurring Order", "Recurring order generation failed: " + ex.Message)  'TODO: Fix logging in general
        result = false;
    }
}

So it seems this can happen when the order is null, which led me to this data in the table EcomRecurringOrders:

You can see a number of orders without a user ID and with an empty or null Base Order ID. Where do those come from? Are these carts? And if so, should the scheduled task ignore those when processing the orders to avoid false positive error messages?

Imar

 


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

I do not know where they come from. We will investigate.

But I have moved the baseorderid check into the RecurringOrder.cs so it will not return recurring orders with no baseorderid.

BR Nicolai

 
Kristian Kirkholt Dynamicweb Employee
Kristian Kirkholt
Reply

Hi Imar

The correction has been made in Dynamicweb version 9.14.5
Download this version from https://doc.dynamicweb.dk/downloads/dynamicweb-9
Or update Packages: Dynamicweb.Ecommerce 1.14.32

Kind Regards
Care Support
Kristian Kirkholt

 

You must be logged in to post in the forum