Page 2 of 2

Re: How to know when ALL the Automation Rules have finished ?

Posted: Wed Oct 26, 2022 1:39 pm
by toddsou
Perfect, thank you.

As mentioned earlier, we can query and identify those AutomationInstance records where their QueuedOn field has been set, thereby indicating they've been placed on the queue for later execution of the "THEN" part of the Process. Now we're questioning the timing of our query. That is, who's to say if there are more records yet to be queued for the targeted Order by the time our query executes? (race condition)

One thought was to re-query until we see one of the records' Status field goes to a value other than 1 (Created) or 4 (Waiting/Idle). This is based on my blind assumption that the execution of any Process's THEN part would not begin until ALL Process' criteria (aka "IF" part) have been evaluated. But maybe that assumption is incorrect? Please confirm.

Alternative guidance appreciated, too.

Regards-

Re: How to know when ALL the Automation Rules have finished ?

Posted: Wed Oct 26, 2022 2:51 pm
by BobRichards
A snippet will be queued only after all criteria are evaluated and are met. We will not add any item to the queue unless we determine the "When" activity needs to be run.

Since the automation snippets are evaluated one at a time, there is no way to determine if all of the "When" activities have been queued. I'm not sure what a good method would be for your use case since that was not a consideration for this feature. Perhaps you can use the fact that the [core].[AutomationLog].[RecordNumber] value is automatically incremented with each row (IDENTITY(1,1)).

Re: How to know when ALL the Automation Rules have finished ?

Posted: Wed Oct 26, 2022 9:33 pm
by toddsou
Will any automation snippets start to run before the system finishes evaluating and perhaps-queueing the remaining automation snippets ?

Or do all criteria evaluations finish before the execution phase beings for those that have been enqueued ?

Re: How to know when ALL the Automation Rules have finished ?

Posted: Thu Oct 27, 2022 8:02 am
by BobRichards
I don't believe a behavior is guaranteed. Do not make assumptions in this area since automation snippets run on the most recent version of the order - which might include after some of the snippets execute.

Re: How to know when ALL the Automation Rules have finished ?

Posted: Tue Nov 08, 2022 4:06 pm
by toddsou
Hi-

What does core.AutomationInstance.IsTopMost represent ?

Thank you.

Re: How to know when ALL the Automation Rules have finished ?

Posted: Wed Nov 09, 2022 4:47 pm
by BobRichards
Sorry but since it is not part of a public API, I cannot provide any information about it. We reserve the right to change its functionality or even remove the field in the future without notice.

From what I saw, it doesn't look like a useful flag regarding your topic anyway. ;)

Re: How to know when ALL the Automation Rules have finished ?

Posted: Tue Mar 28, 2023 2:44 pm
by BobRichards
I wanted to make sure you were aware of a way to determine if automation snippets have failed by creating a Work List item. I didn't know this existed when I was working with you.

Topic URL: Re: Automatic notification in case of failure.