locked
recurring workflow for every hour RRS feed

  • Question

  • Hi,

    I have two workflows which were being triggered manually so far.
    I need to automate them like running the workflow jobs every hour.
    One workflow(to check the status of a task) needs to be run every hour and the other workflow(to close the call after the tasks assigned were completed)
    needs to be run after the first workflow(that means 5 mins later). so second workflow is 1hour 5mins later.
    I did add a wait condition(timeout duration 1 hour) after the first step(checking task status) and then added a child workflow(same task workflow) and activated the process.
    Then I manually triggered for one of the task entity and waited for an hour but it did not reoccur after an hour.
    What am I doing wrong??
    i did the same thing for another workflow except the timeout duration is 1 hour 5mins.
    Thanks for any help!

    Thursday, July 31, 2014 5:10 PM

Answers

  • If I was you, I'd have a master workflow that fires a secondary one. You also need to be careful about the interval between recurring workflows because, if the time between them is too small, CRM will assume that the workflow has got into an infinite loop and it will set it failed after 8 operations.

    I don't know the details of what you want to do but I would set the master workflow up with 'On Demand' and 'Child Workflow' both as true. I would set the first task to be a wait condition for 1 hour (but you may need to increase this if CRM fails it). Then have all of your tasks within this workflow with the last 2 entries being 'Run Workflow'; the first one would be a call to the secondary workflow (which I'll come to in a moment) and the last task to run the master workflow again. This will then pick up the 1 hour wait before running again.

    Your secondary workflow then needs to be set up the same as the master but with a wait of 5 minutes at the start. Then have it perform its tasks but it doesn't need to run itself again as the master workflow will trigger it.

    I hope that makes sense.

    • Proposed as answer by Jon_Evans Friday, August 1, 2014 11:49 AM
    • Marked as answer by roxannaappleby Friday, August 1, 2014 3:12 PM
    Friday, August 1, 2014 11:49 AM

All replies

  • If I was you, I'd have a master workflow that fires a secondary one. You also need to be careful about the interval between recurring workflows because, if the time between them is too small, CRM will assume that the workflow has got into an infinite loop and it will set it failed after 8 operations.

    I don't know the details of what you want to do but I would set the master workflow up with 'On Demand' and 'Child Workflow' both as true. I would set the first task to be a wait condition for 1 hour (but you may need to increase this if CRM fails it). Then have all of your tasks within this workflow with the last 2 entries being 'Run Workflow'; the first one would be a call to the secondary workflow (which I'll come to in a moment) and the last task to run the master workflow again. This will then pick up the 1 hour wait before running again.

    Your secondary workflow then needs to be set up the same as the master but with a wait of 5 minutes at the start. Then have it perform its tasks but it doesn't need to run itself again as the master workflow will trigger it.

    I hope that makes sense.

    • Proposed as answer by Jon_Evans Friday, August 1, 2014 11:49 AM
    • Marked as answer by roxannaappleby Friday, August 1, 2014 3:12 PM
    Friday, August 1, 2014 11:49 AM
  • It can depend on when you want the tasks to run. From what I read in your original post, you want the workflow to wait an hour before running. As such, I suggested adding the wait at the start but if you'd like the tasks to run as soon as the workflow is fired, you'll need to have jusy the 'Start child workflow' tasks after the wait condition.

    First and foremost, you'll need to set the recurring workflow to be a child workflow. I'm going to paste from a workflow on one of my systems which is similar - hopefully it'll give you an idea of what I'm trying to say.

    Essentially, this workflow of mine (called 'On Call Retainer') will wait for 7 days, check to see if a condition has or hasn't been updated and, if it hasn't, it will send out an email and then restart itself so it will then wait another 7 days before checking the condition and so on.

    As I understand it, you want another task that's going to be run 5 minutes later. You can either put this task into another child workflow and have a 2nd call to this workflow or you could include the tasks in this workflow (so after the tasks, you could include another wait condition for 5 minutes followed by the extra tasks and then followed by the call to restart the workflow.

    Friday, August 1, 2014 3:45 PM
  • It didn't include my image - let's try again.

    Friday, August 1, 2014 3:46 PM
  • Ok so what I understood from your suggestion is :
    I need to run my 'Regarding calls Problem solved' workflow in the Child Workflow so that the master workflow(task workflow) can fire it.

    Actually I need to run the Calls Problem solved workflow 5 mins after the task workflow has been run.  And then after an hour again the task workflow has to run and again after 5 mins Calls workflow should run.
    So this is my cycle..

    Friday, August 1, 2014 4:01 PM
  • 1. wait condition : Timeout until 1 hour

    step: Update Task workflow

    wait condition: Timeout 5mins

    start Child Workflow: Regarding Calls Problem Solved

    Here?? What should I do to start the cycle again?

    My workflow stops here..and does nothing after I run the task workflow manually for the first time.

    Please excuse me for manual steps above..

    Thanks

    Friday, August 1, 2014 4:06 PM
  • OK, from what I understand, the workflow you're describing above is called 'Task workflow' and you've also got one called 'Regarding Calls Problem Solved'. It doesn't matter if I've not got that first name right, hopefully you'll get what I'm trying to get at.

    Task Workflow (set as child workflow and to fire from event in 'Start when:')

    Wait condition: Timeout until 1 hour
     - Insert any tasks here that this workflow has to do.
     - Start child workflow: 'Regarding Calls Problem Solved'
     - Start child workflow: 'Task workflow'

    Regarding Calls Problem Solved workflow (also set as child workflow but has no 'Start when:' event)

    Wait condition: Timeout until 5 minutes
     - Insert any tasks here that this workflow has to do.

    This will see the Task Workflow launch when something happens on the form like onCreate, onChange, etc. It will wait an hour, perform some tasks, start the Regarding Calls Problem Solved workflow (which will wait 5 minutes before running) then launch the Task Workflow again which will wait an hour, perform some tasks, etc, etc until the end of time.

    Thinking about it, it would be a good idea to have that Start child workflow: 'Task workflow' call in an if statement as this workflow is going to just keep starting itself over and over again without end. Perhaps something like 'If record status is active' or 'If case status is open' - this way, once a record is deactivated, solved, etc then the workflow will not restart itself.

    • Proposed as answer by ReignFan Tuesday, August 5, 2014 3:21 PM
    Friday, August 1, 2014 4:21 PM