locked
Cancel/Stop a running workflow ... RRS feed

  • Question

  •  

    Paragraph 1

    We have a custom entity form – it has a custom field “Status” …

    As soon as the record status reaches to “Initiated” a custom field “Due Date” is set and a workflow is fired …  The logic in the workflow says that “send an email before 5 days of the ‘Due Date’ ”

     

    Paragraph 2

    Everything is fine so far ….. now the problem is that:

    If  the same Record’s status changes to “On-Hold” then the “Due date” becomes NULL and  when it becomes NULL then we need to Cancel/stop the WF which is already been fired and waiting for 5 days before the due date as I mentioned in paragraph 1

     

    Please advise, thank you.


    AAVI
    Wednesday, July 27, 2011 3:40 PM

Answers

  • It will refer to the new Due Date, as long as the old Due Date has not already passed, and therefore made the Workflow move beyond that Wait stage.
    The postings on this site are solely my own and do not represent or constitute Hitachi Consulting's positions, views, strategies or opinions.
    • Marked as answer by AAVI Tuesday, August 9, 2011 7:18 PM
    Thursday, July 28, 2011 3:08 PM
  • AAVI, when you change Due Date, do you see a new Workflow record, with the previous workflow record still there? If you previously don't have a workflow record, try to change Due Date twice.

    If the Due Date is used as part of the timeout parameter, I am pretty sure that's going to be the case.


    Daniel Cai | http://danielcai.blogspot.com
    • Marked as answer by AAVI Tuesday, August 9, 2011 7:18 PM
    Friday, July 29, 2011 4:05 PM

All replies

  • Check http://ayazahmad.wordpress.com/2009/12/30/auto-complete-recursivewaiting-workflows-microsoft-crm-4/, you need to develop a custom workflow to cancel previous waiting workflow. The implementation was based on CRM4, but should apply to CRM2011.
    Daniel Cai | http://danielcai.blogspot.com
    • Proposed as answer by Jim Glass Jr Thursday, July 28, 2011 12:59 AM
    Wednesday, July 27, 2011 3:57 PM
  • In the same workflow, on the Wait condition, put an Otherwise statement that says "Otherwise, Wait until Due Date does not contain data" and then make the actual step "Stop Workflow, Canceled".
    The postings on this site are solely my own and do not represent or constitute Hitachi Consulting's positions, views, strategies or opinions.
    Wednesday, July 27, 2011 4:21 PM
  • Thanks Wayne and thanks Daniel - just to confirm my undrerstanding ... For example if the Workflow is running and in waiting state for the record where Due Date is "July 29th 2011". Later, user changes this Due date to "Aug 10th 2011". so the workflow which is already running and in waiting state will refer to this new 'Due Date' automatically or will it still refer to the old Due date which was "July 29th 2011"???
     

    AAVI
    Thursday, July 28, 2011 2:58 PM
  • It will refer to the new Due Date, as long as the old Due Date has not already passed, and therefore made the Workflow move beyond that Wait stage.
    The postings on this site are solely my own and do not represent or constitute Hitachi Consulting's positions, views, strategies or opinions.
    • Marked as answer by AAVI Tuesday, August 9, 2011 7:18 PM
    Thursday, July 28, 2011 3:08 PM
  • When a CRM workflow record is created, it is created basod up the snapshot of the record that the workflow is concerned. Any further change will not change the status of the workflow.

    So if I understand you correctly, you will have to cancel the existing workflow record.


    Daniel Cai | http://danielcai.blogspot.com
    Thursday, July 28, 2011 3:31 PM
  • Based on my quick test - it seems that WF refers the new Due date and that confirms what Wayne said.

     However, I cannot ignore what Daniel is saying ... Could you please share your experience in what scenario your statemement "When a CRM workflow record is created, it is created basod up the snapshot of the record that the workflow is concerned. Any further change will not change the status of the workflow" fits? Thanks for your time...


    AAVI
    Friday, July 29, 2011 3:58 PM
  • AAVI, when you change Due Date, do you see a new Workflow record, with the previous workflow record still there? If you previously don't have a workflow record, try to change Due Date twice.

    If the Due Date is used as part of the timeout parameter, I am pretty sure that's going to be the case.


    Daniel Cai | http://danielcai.blogspot.com
    • Marked as answer by AAVI Tuesday, August 9, 2011 7:18 PM
    Friday, July 29, 2011 4:05 PM
  •  

    Well ... what we have done is that we created a new custom attribute 'shadow due date' so, when Due Date changes, the shadow field gains a new value but is never set to null.  If the Due Date field is not null, the shadow field is set equal to Due Date.  If Due Date is null, then the shadow field gets the value of 12/31/2099.  I have done testing on a custom entity and this methodology appears to work as expected.


    AAVI
    Wednesday, August 3, 2011 3:05 PM
  • Let's close this thread ...

    In addition to my last reply - I forgot to mention that our workflow start when the record is Created.

    Daniel's point is valid when the workflow starts on attributes change. So both solutions from Daniel and Wayne are correct based on situation I mentioned.

    Thanks for your time gentlemen.

    Kind regards,


    AAVI
    Tuesday, August 9, 2011 7:18 PM