locked
[CRM 4]This workflow job was canceled because the workflow that started it included an infinite loop. Correct the workflow logic and try again. RRS feed

  • Question

  • Hello

     

    my workflow:

    [CrmWorkflowActivity("My Demo workflow")]
      public partial class MyDemo : Activity
    	{
        public MyDemo()
        {
    
        }
    
        protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
        {
    
          try
          {
            //Debugger.Break();
            IContextService contextService = (IContextService)executionContext.GetService(typeof(IContextService));
            IWorkflowContext context = contextService.Context;
    
            // Create the CRM service
            ICrmService crmService = context.CreateCrmService();
    
            //get all contacts
            //      QueryExpression query = new QueryExpression();
            using (FileStream fileStream = new FileStream(@"C:\inetpub\wwwroot\cwf.log", FileMode.Append))
            {
              byte[] data = System.Text.Encoding.UTF8.GetBytes(DateTime.Now.ToString());
              fileStream.Write(data,0,data.Length);
            }
          }
          catch (Exception exc)
          {
            throw;
          }
    
          return ActivityExecutionStatus.Closed;
        }
    	}
    


    error message: 

    This workflow job was canceled because the workflow that started it included an infinite loop. Correct the workflow logic and try again.

     

    my step is:

    1. my workflow: "MyDemo"

    2. timeout ,wait 1 minute : Dynamic Value ->Duration -> 1 minute

    3. start itself as child workflow

     

    my workflow settings: 

    Start When : non-checked

    Available to Run: checked on Demand, Checked on as a child workflow

     

    i need "infinite loop", just like a scheduler.  

    please advise how to setup a workflow like a scheduler?

     

    any ideas will be appreciated.

     

    Wednesday, June 15, 2011 11:08 AM

Answers

  • Your workflow stops beacuse of the builtin infinitive loop detection. If a workflow calls itselfs seven or more times in a 60 minute intervall, CRM will assume it's an infinitive loop and cancel it.

     

    Try setting the duration of your wait activity to ten minutes instead


    Perhaps this post will help you. It's for 4.0, but still applies to 2011:

    http://mscrmbyutne.blogspot.com/search/label/scheduling


    • Proposed as answer by Torstein Utne Wednesday, June 15, 2011 11:24 AM
    • Marked as answer by nevernet Wednesday, June 15, 2011 12:46 PM
    Wednesday, June 15, 2011 11:24 AM

All replies

  • Your workflow stops beacuse of the builtin infinitive loop detection. If a workflow calls itselfs seven or more times in a 60 minute intervall, CRM will assume it's an infinitive loop and cancel it.

     

    Try setting the duration of your wait activity to ten minutes instead


    Perhaps this post will help you. It's for 4.0, but still applies to 2011:

    http://mscrmbyutne.blogspot.com/search/label/scheduling


    • Proposed as answer by Torstein Utne Wednesday, June 15, 2011 11:24 AM
    • Marked as answer by nevernet Wednesday, June 15, 2011 12:46 PM
    Wednesday, June 15, 2011 11:24 AM
  • I am doing a test in CRM v4.0 where a workflow executes, waits 30 minutes then calls another workflow which calls the original. When the total number of workflows executed or in progress reaches 6, the 7th will cancel with the infinite loop issue. I have seen numerous posts regarding the "no more than 7 per hour" limit, but my experience shows that the limit is not reset even after an hour has elapsed. Does anyone have any suggestions?
    Thursday, August 23, 2012 3:38 PM