Hello Matthew, Good day!! Just wanted to add some examples if it helps -
Using a SYNC object between JOB A & JOB B, will ensure Either A or B can run at a time.
Whereas External Dependency is used to make sure JOB B should have a validation whether JOB A ran earlier as part of different flow/time.
If I understood the requirement, it is like following -
- JOB A ( which is used as ED for JOB B from another work flow ) runs multiple times in a day.
( lets say the JOB A, the ED had 2 successful run with RUNID 1234, 4567 & ED has another ACTIVE instance RUNID 7890. )
- When JOB B gets initiated & based on the ED Parameters, you want to check if at least one execution is found of the ED. IF a latest ED RUN is in progress you want JOB B to WAIT till ED is COMPLETED.
( lets say JOB B should WAIT till ED instance with RUNID 7890 is COMPLETED )
At this moment -
- If you have chosen - the setting - "Check if the external task end is - after the last workflow execution end"
>> The JOB B will pick up RUNID 1234 & gets satisfied. It will NOT bother to check RUNID 4567 OR RUNID 7890.
- Also as you said - if you have chose - setting - "Check if the external task end is - after this workflow start"
and lets say ED RUNID 7890 is going to happen hours later, then the ED is going to WAIT till then. That you want to avoid ( as you said already ).
- If you want to force the ED at waiting state because you want JOB B should pick the RUNID 7890 once that is completed,
>> you need to choose - "Check if the external task end is - within XX : YY : ZZ (hhh:mm:ss) before this workflow start"
>> Now the tricky part will be selecting some window that will NOT allow the ED to pick RUNID 1234 or RUNID 4567 at all.
Lets add some timing for the calculation -
- the JOB A ( that is the ED for the JOB B )
>> RUNID 1234 | starts at 02:00 | ends at 02:10
>> RUNID 4567 | starts at 06:00 | ends at 06:15
>> RUNID 7890 | starts at 10:00 | ends at 10:15
Now the JOB B starts at 10:10 --
>> Then you should keep the settings in the ED properties as following -
EXPECTED STATUS = ENDED_OK
"Check if the external task end is - within 01 : 00 : 00 (hhh:mm:ss) before this workflow start"
The above parameters will force the JOB B to pick the ED instance with RUNID 7890
and the EXPECTED STATUS will for a wait till the ED instance with RUNID 7890 gets COMPLETED.
I hope, I understood your requirement as above is correct & the details I explained above helps!! Thanks.