web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

workflow fails due to infinite loop

(0) ShareShare
ReportReport
Posted on by
Hi, I have a workflow that works on create and update on fieild1 as a background WF, in the code I set the text field field2 to /test/ this is the only
thing i do in the WF code. however when checking the workflow history its initiating multiple running processes and failing after due to: /This workflow job was canceled because the workflow that started it includes an infinite loop./ the entity has no other plugin or code that changes field1. even i tested the WF on different entity with same result
what could be the problem?
Thank you
 
this is my execute method
 
       // Create the context
       IWorkflowContext context = executionContext.GetExtension<IWorkflowContext>();
       if (context == null)
       {
           throw new InvalidPluginExecutionException(/Failed to retrieve workflow context./);
       }
       IOrganizationServiceFactory serviceFactory = executionContext.GetExtension<IOrganizationServiceFactory>();
       IOrganizationService service = serviceFactory.CreateOrganizationService(context.UserId);
       OrganizationServiceContext OrgServiceContext = new OrganizationServiceContext(service);
       Entity formEntity = service.Retrieve(context.PrimaryEntityName, context.PrimaryEntityId, new ColumnSet(true));

       formEntity.Attributes[/field2/] = /test/;
       service.Update(formEntity);
 
 
I have the same question (0)
  • Suggested answer
    Pedro Cadavez de Freitas Profile Picture
    on at
    workflow fails due to infinite loop
    Hello,

    Isn't this the case that you are actually updating the full object again via plugin but you only change the attribute field2?
     
    Regarding workflow triggers, if you are updating the full object again which included also field1, from X to X, workflows will trigger although there was no "change".
     
    This is a classic scenario for workflow infinite loops or extreme unwanted bursts of workflow executions.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 258

#2
MVP-Daniyal Khaleel Profile Picture

MVP-Daniyal Khaleel 186

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 130 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans