Page 1 of 2

How to know when ALL the Automation Rules have finished ?

Posted: Tue Jul 26, 2022 2:46 pm
by toddsou
Hi-

If I have authored and enabled a bunch of Automation Rules, I'd like to programmatically know when the entire set has finished running. As you probably know, they run in random order, so it's not like I can simply add some sort of event notification to the last one and wait to receive that event.

What do you recommend?

I see from the SPAdmin/Automation/Monitoring module that the administrator can monitor when these Automation Rules run, and eventually finish. Is this information also available via SPS SDK? (or, perhaps certain table(s) within the SPS db ?)

Regards,
Todd

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

Posted: Tue Aug 09, 2022 10:55 am
by BobRichards
Followup: Do you want to ensure all automation snippets have run for a specific order or all orders?

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

Posted: Wed Aug 17, 2022 4:58 pm
by toddsou
Specific order.

Thanks.

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

Posted: Mon Aug 22, 2022 11:08 am
by BobRichards
R&D has provided a solution that uses direct access to the Select SQL database. The script aggregates the automation snippet information and in the final "where" clause you provide the integer value of the order identifier (query RootID in pf.Order).

Code: Select all

SELECT TOP (1000)
	O.Number as 'File Number'
	,AI.ExecutionCorrelation as 'Automation Instance'
	,AI.QueuedOn as 'Automation Queued On'
	, AI.LastRunOn as 'Automation Last Run On'
	, AI.Reason as 'Auotmation Message'
	,[Level]
	,[User]
	,[Message]
	FROM [SelectDb].[pf].[OrderLog] as OL
	Left Join pf.[Order] as O on OL.RootID = O.RootID
	Left Join [SelectDb].core.AutomationInstance as AI on O.Guid = AI.ExecutionCorrelation
	Where OL.RootID = '-2147483639'
2022-08-22_10-59-52.png
2022-08-22_10-59-52.png (148.84 KiB) Viewed 8265 times

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

Posted: Sun Oct 23, 2022 11:07 pm
by toddsou
This is great. tyvm.

As you know, the Automation Rules follow a "When this, then That" format.

These logs shown here capture the execution of the "That" part.

Is there also something which captures the execution of the "When" part, as well?

For example, if I defined a Process that only ran for Orders created under the Profile of "Default\ABC Office" (and maybe a few other params), could I find database entries which illustrated that a particular Process met that criteria and when it didn't ?

Thank you.

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

Posted: Mon Oct 24, 2022 11:10 am
by BobRichards
Automation follows a When/If/Then format. When an automation snippet it triggered (the "When"), Select evaluates the "If" criteria and if all are met, it will queue the "Then" activity. We do not store any information about snippets that fail to meet the criteria. The previously described SQL query provides that only information available.

As you can imagine, if we kept information about orders that that didn't meet criteria, the table would grow huge in a short time.

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

Posted: Tue Oct 25, 2022 10:24 am
by toddsou
Thanks, Bob. That all makes sense.
Select evaluates the "If" criteria and if all are met, it will queue the "Then" activity
Would that be the SelectDb.core.AutomationInstance.QueuedOn column ?

If so, then I think that might be the "tell" that I'm looking for to indicate that a particular Workflow's criteria was met, for a given Order....

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

Posted: Tue Oct 25, 2022 1:49 pm
by BobRichards
That is correct.

I just want to make you aware of the [core].[AutomationInstanceView] view in case you ever need more information about the automation snippet.

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

Posted: Wed Oct 26, 2022 8:17 am
by toddsou
...and what are the available values for core.AutomationInstance.Status ?

Just from observation, I've noted the following so far:
4 = Queued (aka criteria met, but not yet executed...I held the saved Order open)
2 = Running (once the Order was closed )
8 = Done

I think the View you recommended mentioned 128 = canceled ?

Is there another Status value for Failed? any others?

Thank you!

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

Posted: Wed Oct 26, 2022 9:57 am
by BobRichards
See enum ProcessInstanceStatus in namespace SoftPro.Select.Client.Automation (Assembly: SoftPro.Select.Client.dll) for the full list of states.