locked
Call a workflow a dynamic number of times? (CRM 4.0 Online) RRS feed

  • Question

  • Is there way to call a Workflow a dynamic number of times?  I have a field with a number in it, and I would like to call a certain workflow by that number of times.

    Is there a good way to do that?
    Friday, January 23, 2009 6:53 PM

Answers

  • Never mind, answered my own question.  I created two fields, Incrementer and IncrementerStatic. 

    I then made two Workflows, one that sets Incrementer to 0 and IncrementerStatic to 1 when creating an the entity, and then another that does the action I want, and then uses IncrementerStatic to incremetn Incrementer by 1.  I then call that workflow from itself and use a check condition to see if Incrementer is still below the value I was checking agianst for the number of times I wanted to run the workflow.

    It feels like a horrible hack, but it works.

    Well, mostly.  Now I need to know how to get around the "this is a loop!" warnings CRM is now throwing.  It isn't an infinite loop, it will terminate properly as long as I keep it low enough to not trigger that warning.  Is there a time delay I can put in that will resolve that issue?
    Friday, January 23, 2009 7:34 PM

All replies

  • Never mind, answered my own question.  I created two fields, Incrementer and IncrementerStatic. 

    I then made two Workflows, one that sets Incrementer to 0 and IncrementerStatic to 1 when creating an the entity, and then another that does the action I want, and then uses IncrementerStatic to incremetn Incrementer by 1.  I then call that workflow from itself and use a check condition to see if Incrementer is still below the value I was checking agianst for the number of times I wanted to run the workflow.

    It feels like a horrible hack, but it works.

    Well, mostly.  Now I need to know how to get around the "this is a loop!" warnings CRM is now throwing.  It isn't an infinite loop, it will terminate properly as long as I keep it low enough to not trigger that warning.  Is there a time delay I can put in that will resolve that issue?
    Friday, January 23, 2009 7:34 PM
  • Hi Wayne,

     

    I experienced the same problem, here's a post of what I found, not sure if it's what your dealing with:

     

    http://www.crowehorwath.com/cs/blogs/crm/archive/2009/01/19/infinite-loop-in-crm-workflow-custom-assembly.aspx

     

    Good luck!

     

    Saturday, January 24, 2009 5:35 PM
  • Good to know, thanks.
    Monday, January 26, 2009 3:05 PM
  • My 2 cents.... At the moment if a workflow calls itself more than 7 times in an hour, Crm deems it as an infinite loop and cancels it. We did a workaround by using a Console Application which can be scheduled using the Task Scheduler. Have to wait till the next version of Crm and hoping that it would handle recurring workflows/batch scheduled jobs.

    -Maruf
    Tuesday, February 3, 2009 6:13 AM