Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 55831

This workflow job was canceled because the workflow that started it included an infinite loop. Correct the workflow logic and try again. For information about workflow logic, see Help

$
0
0

I've following code snippet to update the child accounts. But I got the exception that This workflow job was canceled because the workflow that started it included an infinite loop. Correct the workflow logic and try again. For information about workflow logic, see Help. Can anybody help out me in this?

public void Execute(IServiceProvider isp) {
            ITracingService iTrace = (ITracingService)isp.GetService(typeof(ITracingService));
            IPluginExecutionContext context = (IPluginExecutionContext)isp.GetService(typeof(IPluginExecutionContext));
            IOrganizationServiceFactory factory = (IOrganizationServiceFactory)isp.GetService(typeof(IOrganizationServiceFactory));
            IOrganizationService service = factory.CreateOrganizationService(context.UserId);
            if (context.PostEntityImages.Contains("postimage")&& context.PostEntityImages["postimage"] is Entity)
            {
                Entity account = (Entity)context.PostEntityImages["postimage"];
                if (account.Attributes.Contains("parentaccountid"))
                 {
                 if (account.Attributes.Contains("new_bigforagenciescustomer"))
                {
                   QueryExpression child = new QueryExpression{
                       EntityName = "account",
                       ColumnSet = new ColumnSet("parentaccountid"),
                       Criteria = new FilterExpression{
                       Conditions={
                           new ConditionExpression("parentaccountid",ConditionOperator.Equal,account.Id)
                       }}
                   };

                   EntityCollection ec = service.RetrieveMultiple(child);
                    foreach (Entity childs in ec.Entities)
                    {
                        childs["new_bigforagenciescustomer"] = account.Attributes["new_bigforagenciescustomer"];
                        service.Update(childs);
                    }
                }
                 }
            }
        }



Viewing all articles
Browse latest Browse all 55831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>