locked
Workflow - Wait condition RRS feed

  • Question

  • I have created workflow on task entity to send email on task due date time.

    I have created workflow as

    1.       Wait condition: workflow execution condition equal to Task Due date.

    2.       Send Email.

    This works fine and it sends email on task due date.

    Now the problem is I create as task with due date as 06/04/2009, so it creates new workflow instance for this.

    Now I will go to the same task change the due date to 06/07/2009.

    In this scenario it creates second workflow instance and finally it sends two emails on 06/07/2009.

    Is there any way to update/delete previous workflow instance?

    Thursday, June 4, 2009 8:27 PM

Answers

  • Make the due date compulsory unless this is not practical for the business. In this case one way to get around this would be to have a flag on the task record. The workflow would trigger off the update and check if the flag had been ticked, if not tick the box and enter the wait state as before. The next time the due date is updated, the original workflow will automatically adjust and the new workflow will immediately end as the flag is now ticked.

    Leon Tribe
    Want to hear me talk about all things CRM? Check out my blog
    Friday, June 5, 2009 5:48 AM

All replies

  • It sounds like your trigger is set incorrectly. Set the trigger for the task to be the task creation. The way workflows work is if the due date gets adjusted and you have the workflow set to timeout until due date, if the due date gets adjusted the workflow will automatically adjust.

    Leon Tribe
    Want to hear me talk about all things CRM? Check out my blog
    • Proposed as answer by Leon TribeMVP Thursday, June 4, 2009 9:33 PM
    Thursday, June 4, 2009 9:32 PM
  • Hi Leon,
    Thanks for the reply.

    Suppose while creating new task user will not set Due date, then later updates the same task with some Due date, in this scenerio i may need to create WF instance when taks is update. then every time user updates due date it will create multiple instance of WF.
    Thursday, June 4, 2009 9:44 PM
  • Hi Nirmal,

    Another solution is to make the due date field read only once data is entered into the field
    Thus you can restrict the workflow execution
    Thanks, Aarch
    Friday, June 5, 2009 5:19 AM
  • Make the due date compulsory unless this is not practical for the business. In this case one way to get around this would be to have a flag on the task record. The workflow would trigger off the update and check if the flag had been ticked, if not tick the box and enter the wait state as before. The next time the due date is updated, the original workflow will automatically adjust and the new workflow will immediately end as the flag is now ticked.

    Leon Tribe
    Want to hear me talk about all things CRM? Check out my blog
    Friday, June 5, 2009 5:48 AM
  • Hi Leon,

    Thanks for trick, and the trick works very well.

    But i can't make Due data as mandatory field. Now the problem is i will create task with valid due date, accordingly it creates workflow instance in 'waiting' status.

    Then later user will open the same task, and removes the due date. Then in this scenerio the running workflow will remain in 'Waiting' status.

    I tried to add OR condition for workflow timeout but it does not support more than one condition.

    Thanks
    -Nirmal
    Friday, June 5, 2009 8:36 PM
  • I hope my original reply was clear. If a compulsory field is not practical, use the flag.

    In answer to your query regarding the removal of the date field at a later time, you can put in a wait branch which closes the workflow if any one of the conditions are met. An alternative branch could be checking the due date to see if it is blank (I'm assuming you can check if a date field is blank).

    Leon Tribe
    Want to hear me talk about all things CRM? Check out my blog
    • Proposed as answer by Leon TribeMVP Saturday, June 6, 2009 12:55 AM
    Saturday, June 6, 2009 12:55 AM
  • Nirmal, 
      You may follow these steps.
      1. Set the Triggers for your WorkFow for Creation and Change Of Due Date.
      2. Handle the Scenario Where Due Date is a Past Date or Blank and in that Case, Stop the WorkFlow with a Status of Succeeded. Make sure you Check this scenario BEFORE the Send Email Step.
      3. As mentioned by Leon, combine this with the flag approach so that you dont run the risk of sending the Mail Twice.

    As far as Waiting WorkFlows are concerned, you can actually write a Single Executable (Background Program/Service) which takes care of Cancelling the WorkFlow instances which are no longer applicable. This is a general solution which might apply to other workflows as well.


    Regards,
    Maruf
    • Proposed as answer by Maruf Saturday, June 6, 2009 10:42 AM
    Saturday, June 6, 2009 10:41 AM