Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Help with infinite loop error in Workflow

Posted on by Microsoft Employee

Hi There,


I am using MS Dynamics CRM 2011 on premise with Click Dimensions email marketing solution. I've set up a workflow to trigger on certain conditions. I keep getting the following error but cannot see where the infinite loop is. Any assistance would be greatly appreciated. The error message is below.
5342.Complete-Workflow-Screenshot.JPG

Thanks

Dave

Plugin Trace:

[Microsoft.Xrm.Sdk.Workflow: Microsoft.Xrm.Sdk.Workflow.Activities.CreateEntity]
[CreateStep73: Send Acknowledgement Email 1 ]

    
    [ClickDimensions.Crm.MsCrm2011Plugins: ClickDimensions.Crm.MsCrm2011Plugins.SendEmailWFPlugin]
    [cea55c7d-5312-e011-8519-78e7d162ee67: ClickDimensions.Crm.MsCrm2011Plugins.SendEmailWFPlugin: Create of cdi_sendemail]
    
    SendEmailWFPlugin: Execute() started.
    Create Email Send record
    Associate cdi_emailsend; emailsendId:2bb22595-c6bc-e611-8bd7-0050568251a8; relatedEntityName:contact; relatedEntityId:10575c09-1664-4394-88e8-8b600187c410
    
    


Error Message:

Unhandled Exception: Microsoft.Xrm.Sdk.InvalidPluginExecutionException: Error in SendEmailWFPlugin plugin, Message: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.Stack:
Server stack trace:
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
   at Microsoft.Crm.Sandbox.SandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [1]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.Crm.Sandbox.ISandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)
   at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.ExecuteInternal(OrganizationRequest request)
   at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.AssociateInternal(String entityName, Guid entityId, Relationship relationship, EntityReferenceCollection relatedEntities)
   at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.Associate(String entityName, Guid entityId, Relationship relationship, EntityReferenceCollection relatedEntities)
   at ClickDimensions.Crm.MsCrm2011Plugins.SendEmailWFPlugin.ProcessSendEmailWFPlugin(IOrganizationService service, ITracingService tracer, Entity entity)
   at ClickDimensions.Crm.MsCrm2011Plugins.SendEmailWFPlugin.Execute(IServiceProvider serviceProvider);
;
Server stack trace:
   at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
   at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
   at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
   at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
   at Microsoft.Crm.Sandbox.SandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [1]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.Crm.Sandbox.ISandboxOrganizationService.Execute(String operation, Byte[] serializedRequest)
   at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.ExecuteInternal(OrganizationRequest request)
   at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.AssociateInternal(String entityName, Guid entityId, Relationship relationship, EntityReferenceCollection relatedEntities)
   at Microsoft.Crm.Sandbox.SandboxOrganizationServiceWrapper.Associate(String entityName, Guid entityId, Relationship relationship, EntityReferenceCollection relatedEntities)
   at ClickDimensions.Crm.MsCrm2011Plugins.SendEmailWFPlugin.ProcessSendEmailWFPlugin(IOrganizationService service, ITracingService tracer, Entity entity)
   at ClickDimensions.Crm.MsCrm2011Plugins.SendEmailWFPlugin.Execute(IServiceProvider serviceProvider); CONTEXT INFORMATION: ----------
UserId: 8d331333-d65b-e111-84e9-00155d4a2308
OrganizationId: d7e6ef1d-7b5b-46b7-9755-6a0d1aa29914
OrganizationName: EdinburghBusinessSchool
MessageName: Create
Stage: 20
Mode: 0
PrimaryEntityName: cdi_sendemail
SecondaryEntityName: none
BusinessUnitId: d9ad9246-2c4f-e111-97bc-00155d4a2205
CorrelationId: 4535b070-7a59-4552-9003-18bf7cf0224e
Depth: 7
InitiatingUserId: 8d331333-d65b-e111-84e9-00155d4a2308
IsExecutingOffline: False
IsInTransaction: True
IsolationMode: 2
Mode: 0
OperationCreatedOn: 07/12/2016 21:46:19
OperationId: 00000000-0000-0000-0000-000000000000
PrimaryEntityId: 27b22595-c6bc-e611-8bd7-0050568251a8
OwningExtension LogicalName: sdkmessageprocessingstep
OwningExtension Name: ClickDimensions.Crm.MsCrm2011Plugins.SendEmailWFPlugin: Create of cdi_sendemail
OwningExtension Id: cea55c7d-5312-e011-8519-78e7d162ee67
SharedVariables: DefaultsAddedFlag: True;
InputParameters: Target:
 LogicalName: cdi_sendemail
 EntityId: 27b22595-c6bc-e611-8bd7-0050568251a8
 Attributes: [cdi_sendemailid: 27b22595-c6bc-e611-8bd7-0050568251a8; cdi_fromname: Edinburgh Business School; cdi_fromrecordowner: False; owningbusinessunit: Microsoft.Xrm.Sdk.EntityReference; modifiedonbehalfby: ; statecode: Microsoft.Xrm.Sdk.OptionSetValue; modifiedon: 07/12/2016 21:46:19; statuscode: Microsoft.Xrm.Sdk.OptionSetValue; createdby: Microsoft.Xrm.Sdk.EntityReference; cdi_emailtemplateid: Microsoft.Xrm.Sdk.EntityReference; ownerid: Microsoft.Xrm.Sdk.EntityReference; cdi_subject: ${Recipient.contact.firstname[0]!""} - Thanks for getting in touch; cdi_fromemail: info@ebs.hw.ac.uk; owninguser: Microsoft.Xrm.Sdk.EntityReference; modifiedby: Microsoft.Xrm.Sdk.EntityReference; cdi_contactid: Microsoft.Xrm.Sdk.EntityReference; createdon: 07/12/2016 21:46:19; ]
OutputParameters:
PreEntityImages:
PostEntityImages:
----------


*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Help with infinite loop error in Workflow

    Hi

    I read from the exchange that you're open to trying third-party CTIs. Have you checked out Tenfold? It connects phones to MS Dynamics CRM seamlessly, enabling the sales call workflow to be more efficient. It offers a lot of functions that you may find useful in your call center. www.tenfold.com/.../dynamics

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Help with infinite loop error in Workflow

    Hi Pawel, I manager to fix the workflow infinite loop by tidying them up! So delighted. Thanks for your help.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Help with infinite loop error in Workflow

    Great advice Pawel. all makes sense to me. I'll give this a go and report back on how I get on.

    Dave

  • tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: Help with infinite loop error in Workflow

    Hi Dave,

    Yes you can just restructure a little your workflows not to call to many child workflows and that should do the trick (that's why I asked you to do this simple test with simplified workflow few posts before).

    Activated workflows that are not used do not have any impact here (but it's a good habit anyway to deactivate workflows that you are not using, it makes life simplier for system admin, who sometimes has to go through all workflows in order to find some error or optimize something in the system)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Help with infinite loop error in Workflow

    Hi Pawel, Many thanks for your reply. As I'm an end user and to get IT to access the deployment manager and do some background work will take time, im wondering if I can fix this issue in the short term by simply reviewing the logic in my workflows and reducing the number of Child Workflows? Secondly, I have a lot of unused workflows containing child workflows in the system still activated. If I deactivate these would this have an impact?

    Dave

  • Verified answer
    tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: Help with infinite loop error in Workflow

    Hi Dave,

    This message is saying about loop but in fact the problem is with Depth. If it's too hight then this exception will be thrown. And the depth is increased every time you call a child workflow (which in your case you can control) and call a plugin and a plugin from plugin (in this case it's ClickDimensions and you can't control that). So it does not have to be the loop (it's just the most common issue, but in your case you just have to many child workflows)

    Pawel

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Help with infinite loop error in Workflow

    Hi Pawel,

    Many thanks for this. There is no looping in the workflow though so how would it be causing this?

    Dave

  • tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: Help with infinite loop error in Workflow

    Hi Dave,

    See my previous post, I think that might be the reason for such behaviour. Try to change the MaxDepth setting for your CRM

    Pawel

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Help with infinite loop error in Workflow

    Hi Pawel,


    Thanks for your detailed explanation. To answer your first question on the test of a dummy workflow. See my screenshots Workflow A an B. This is an example of where a different condition is satisfied in Workflow A and this triggers Workflow B to send an email through ClickDimensions successfully. The indefinite loop does not occur in this instance even though it's the exact same workflow just with a different name?

    DaveWorkflow-B.JPGWorkflow-B.JPG

  • Suggested answer
    tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: Help with infinite loop error in Workflow

    Hi Dave,

    The problem is that you violated the maximum Depth for the workflows. Set the maximum depth for the workflows to bigger value and check again:

    The maximum depth (8) and time limit (one hour) are configurable by the Microsoft Dynamics 365 administrator using the PowerShell command Set-CrmSetting. The setting is WorkflowSettings.MaxDepth. For more information, see, “Administer the deployment using Windows PowerShell” in the Deploying and administering Microsoft Dynamics CRM.

    Pawel

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans