Automic Workload Automation

Expand all | Collapse all

Workflow after previous

  • 1.  Workflow after previous

    Posted 05-21-2019 04:51 AM

    Hello Community,

    can you help me next one:

    I have two workflow.

    First workflow (WF1) start at 10:00.

    After end WF1 + 10 min must start second workflow (WF2) and work every 10 min till 23:59.

    How can I do this in UC4?



  • 2.  Re: Workflow after previous

    Posted 05-21-2019 06:21 AM

    Dear Mikhail,

    you can start an event-object at the end of the first workflow, that triggers the second workflow every 10 Minutes. The event can be configured in a way that it triggers the second workflow 10 minutes after it's start the first time. You need to do a little scripting in the event object, so that the event terminates itself after 23:59.

    If you cannot insert the event object as the last task into the first workflow (because then it would terminate when the event would terminate), you can activate the event by script (activate_uc_object without wait) or put workflow one and the event into a ew parent workflow.

    That's what my first idea was when reading your question.

    Regards,

    Nicole



  • 3.  Re: Workflow after previous

    Posted 05-21-2019 09:34 AM

    A couple other possible approaches:

     

    Approach #1:

    Setup a two-step master workflow ("WF_1_2") consisting of WF1 followed by WF2.

    WF1 must have the following logic within it:

    1. It must record the date it last ran (e.g., in a variable object)
    2. The last step of the workflow should be a 10-minute time event
    3. in the workflow's process tab, have the workflow do a ':stop nomsg, 50, "This workflow already ran today" ' if the current date matches the last run date (recorded in the variable object from #1) 

    WF2 must be configured to use a dependency of ANY_OK (as opposed to ENDED_OK)

     

    Now setup a period container for WF_1_2, running every 10 minutes from 10:00 to 23:59.

     

    Approach #2:

    Add a new script task to WF2 to check when WF1 was last run.  (As with Approach #1, you'll probably want to record this date in a variable object, or else use :GET_STATISTIC_DETAIL for it.)  If the last run of WF1 was on the current date, then the script task ends.  Otherwise, it should kick off WF1 using ACTIVATE_UC_OBJECT -- making sure to use the WAIT parameter -- and then follow that with a :WAIT 600 to get your 10 minute delay.

    Now, simply setup a period container for WF2, running every 10 minutes from 10:00 to 23:59.



  • 4.  Re: Workflow after previous

    Posted 05-21-2019 12:30 PM

    I suspect the "must start 10 minutes after WF1 finishes" requirement is just a "nice to have", rather than a technical requirement.

     

    So I would be tempted to schedule WF2 to run at 10:10, 10:20, 10:30, 10:40, 10:50, 11:00, 11:10, 11:20, 11:30, 11:40, 11:50, and 11:59, and add a process script to WF2 that checks for recent completion of WF1.  If WF1 has not completed recently, then WF2 would quit (:stop NOMSG).

     

    One benefit of this method, is the iterative runs of WF2 would show up on forecast reports.



  • 5.  Re: Workflow after previous

    Posted 05-23-2019 10:23 AM

    We have a group that does almost exactly this.  With a parent workflow that contains both of your workflows, on the properties of the second workflow, the post-conditions tab, just state that if it is before 23:59, to restart the task after 10 minutes.  

     



  • 6.  Re: Workflow after previous

    Posted 05-23-2019 12:46 PM

    In this use-case, it should make sure it only does a restart between 22:00 and 23:59.  You would want it to protect itself from 'what if' it didn't run until after midnight due to an unforeseen delay.



  • 7.  RE: Workflow after previous

    Posted 09-22-2020 10:38 AM

    You could schedule the second workflow on a event with your "from" and "to" times defined and add an "external dependency" in the second workflow that the first one must have completed. 

    Of course, you'd have to test it, but the "Execution Settings" with the "If the external task was activated with the same..." box checked should probably work for you. 

    (With this screenshot, and in my case, I needed the previous object to have ended within the previous day.)