Strange behaviour scheduled events

1
Hello fellow mendix developers,   I have a scheduled event timed to send out all shifts via email from the previous month at 8 am on the second day of the month.  The retrieval for the shifts is the following where i created a date time variable called PreviousMonth with “addMonths([%CurrentDateTime%],-1)” and then retrieve all my entities via “month-from-dateTime(Date) = month-from-dateTime($PreviousMonth) ”.   I tested the microflows with a manuel button press to see if the scheduled event would deliver the correct dates and it indeed did. Then the scheduled event ran at the start of the month and all the shifts were offset by one day and I can not explain the reasoning for this.   Any idea what the issue could be?   Left is the scheduled event and right the manual execution   These are my scheduled event settings.   Edit: By changing the localization of the attribute the excel export now delivers the correct data. But now i have the issue that the scheduled event won’t run properly and just rolls back my changed made inside of it.   Failed to execute task 'StandbyApp.ACT_MonthlyEmailSending()' for scheduled event 'StandbyApp.Monthly_Email' from task queue 'System.ScheduledEventsQueue'. -------- com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreRuntimeException: Exception occurred in action '{"current_activity":{"type":"End"},"name":"StandbyApp.ACT_MonthlyEmailSending","type":"Microflow"}', all database changes executed by this action were rolled back at com.mendix.basis.actionmanagement.ActionManager.executeSync(ActionManager.scala:110) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: com.mendix.core.CoreRuntimeException: Exception occurred in action '{"current_activity":{"type":"End"},"name":"StandbyApp.ACT_MonthlyEmailSending","type":"Microflow"}', all database changes executed by this action were rolled back at com.mendix.util.classloading.Runner$.withContextClassLoader(Runner.scala:23) Caused by: com.mendix.core.CoreRuntimeException: Exception occurred in action '{"current_activity":{"type":"End"},"name":"StandbyApp.ACT_MonthlyEmailSending","type":"Microflow"}', all database changes executed by this action were rolled back at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.processErrorState(CoreActionHandlerImpl.scala:153) Caused by: com.mendix.systemwideinterfaces.MendixRuntimeException: Autocommitted objects detected at end of transaction for system session for entities: - StandbyApp.ExcelExport: 5 instances at com.mendix.basis.action.RequestScope.$anonfun$endTransaction$3(RequestScope.scala:163) at scala.Option.foreach(Option.scala:437) at com.mendix.basis.action.RequestScope.verifyNoAutoCommitsExist$1(RequestScope.scala:156) at com.mendix.basis.action.RequestScope.$anonfun$endTransaction$7(RequestScope.scala:171) at com.mendix.basis.action.RequestScope.$anonfun$endTransaction$7$adapted(RequestScope.scala:166) at scala.Option.foreach(Option.scala:437) at com.mendix.basis.action.RequestScope.endTransaction(RequestScope.scala:166) at com.mendix.basis.action.ContextImpl.endTransaction(ContextImpl.scala:76) at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.scala:129) at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:58) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.doCall(CoreActionHandlerImpl.scala:71) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:48) at com.mendix.core.actionmanagement.internal.InternalCoreAction.call(InternalCoreAction.java:57) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.$anonfun$runMonitoredAction$1(CoreActionHandlerImpl.scala:59) at com.mendix.basis.actionmanagement.ActionMonitoring$.$anonfun$monitor$1(ActionMonitoring.scala:52) at com.mendix.util.classloading.Runner$.withContextClassLoader(Runner.scala:20) at com.mendix.basis.actionmanagement.ActionMonitoring$.monitor(ActionMonitoring.scala:52) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.runMonitoredAction(CoreActionHandlerImpl.scala:59) at com.mendix.basis.actionmanagement.CoreActionHandlerImpl.call(CoreActionHandlerImpl.scala:46) at com.mendix.core.actionmanagement.internal.InternalCoreAction.call(InternalCoreAction.java:57) at com.mendix.basis.actionmanagement.ActionManager.$anonfun$executeSync$2(ActionManager.scala:106) at com.mendix.util.classloading.Runner$.withContextClassLoader(Runner.scala:20) at com.mendix.basis.actionmanagement.ActionManager.executeSync(ActionManager.scala:105) at com.mendix.basis.actionmanagement.MicroflowCallBuilderImpl.execute(MicroflowCallBuilderImpl.scala:62) at com.mendix.modules.queue.MicroflowTask.$anonfun$execute$1(MicroflowTask.scala:34) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) at scala.util.Try$.apply(Try.scala:210) at com.mendix.modules.queue.MicroflowTask.execute(MicroflowTask.scala:31) at com.mendix.modules.queue.ScheduledEvents$WrappedTask.$anonfun$execute$2(ScheduledEvents.scala:192) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) at com.mendix.basis.actionmanagement.UserScheduledAction$.logExecution(UserScheduledAction.scala:59) at com.mendix.modules.queue.ScheduledEvents$WrappedTask.$anonfun$execute$1(ScheduledEvents.scala:192) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) at scala.util.Try$.apply(Try.scala:210) at com.mendix.modules.queue.ScheduledEvents$WrappedTask.execute(ScheduledEvents.scala:192) at com.mendix.modules.queue.TaskDispatcher.executeTask(TaskDispatcher.scala:229) at com.mendix.modules.queue.TaskDispatcher.$anonfun$dispatchTask$2(TaskDispatcher.scala:209) at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.scala:18) at com.mendix.modules.queue.MendixTaskQueueMetrics$QueueBasedMetricsImpl.$anonfun$timeTaskExecution$1(TaskQueueMetrics.scala:44) at io.micrometer.core.instrument.composite.CompositeTimer.record(CompositeTimer.java:69) at com.mendix.metrics.micrometer.MicrometerTimer.record(MicrometerTimer.scala:29) at com.mendix.modules.queue.MendixTaskQueueMetrics$QueueBasedMetricsImpl.timeTaskExecution(TaskQueueMetrics.scala:44) at com.mendix.modules.queue.TaskDispatcher.$anonfun$dispatchTask$1(TaskDispatcher.scala:209) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834)     BR  
asked
2 answers
1

looks like Mendix is trying to autocommit an association that is not commited yet but is set:

https://forum.mendix.com/link/space/microflows/questions/89025

answered
0

You could try to log in the scheduled event what the time is of the data retrieval and the manual one, to check if there is some unexpected behaviour, as far as I can see the retrieval is correct.

answered