Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

Is it possible to update the depth in custom workflow/plugin using code?

Posted on by 1,654

Hello,

I wanted to reset the depth value from my custom workflow/plugin itself based on some conditions. Is it possible? Or is it possible to change the WorkflowSettings.MaxDepth property from my code?

Thanks.

  • Suggested answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 on at
    RE: Is it possible to update the depth in custom workflow/plugin using code?

    No, it is not possible to reset depth. It will be set by the platform based on the execution.

    If you are online then No, you cannot change the WorkflowSettings.MaxDepth from your code.

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: Is it possible to update the depth in custom workflow/plugin using code?

    Hi Inkey Solutions,

    Every time a running Plugin or Workflow issues a message request to the Web services that triggers another Plugin or Workflow to execute, the Depth property of the execution context is increased. If the depth property increments to its maximum value within the configured time limit, then the platform considers this behaviour an infinite loop and cancels all further Plugin and Workflow execution.

    The maximum depth of eight and time limit of one hour are configurable by the Microsoft Dynamics 365 administrator using the PowerShell command Set-CrmSetting and the WorkflowSettings.MaxDepth Property. However, I do not recommend changing these values.

  • Suggested answer
    Mahadeo Matre Profile Picture
    Mahadeo Matre 17,021 on at
    RE: Is it possible to update the depth in custom workflow/plugin using code?

    Hi.

    I think it is possible using PowerShell command Set-CrmSetting, but not recommended to change default setting  unless it is necessary.

    These default settings might be reverted back to default values when you install / update CRM system. 

    Check below articles

    docs.microsoft.com/.../gg458341(v%3Dcrm.8)

    community.dynamics.com/.../237674

    stackoverflow.com/.../ms-crm-maxdepth-workflow-setting

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Is it possible to update the depth in custom workflow/plugin using code?

    Hello,

    I don't think that's possible.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans