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