Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

CRM 9 plugin depth greater than CRM 2016

(0) ShareShare
ReportReport
Posted on by 25

Hello,

We're exploring the feasibility of CRM 9 now and we have it installed in some sandbox type environments.  We have an issue that I've been able to work around but I would like to know why it's happening.

In the plugin we have something that calls out to a custom service to update sales order information in our financial system.  That call is fired when the plugin has an update message and the plugin depth is less than 2.  When we installed CRM 9 it now seems like the plugin depth comes in at 2 instead of 1 like it used to come in in 2016.  Our code has not changed, and everything should be the same instead of our CRM version.

I'm not completely certain that we weren't depending on a bug in CRM 2016 and that CRM 9 just fixed this bug.  I'm just trying to find out if that's the case so that we at least have an explanation.  Does anyone know if they changed the way the depth is determined in CRM 9 on prem?

Categories:
  • Aaron S Profile Picture
    Aaron S 25 on at
    RE: CRM 9 plugin depth greater than CRM 2016

    OK, I understand, and we will take that into consideration.  Thanks for your reply.

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,052 on at
    RE: CRM 9 plugin depth greater than CRM 2016

    Hi

    As best practice, we should avoid our plugin code logic being dependent on the depth. Please see below

    "Used by the platform for infinite loop prevention. In most cases, this property can be ignored. You should not take a business logic dependency on this value. The value is relative and may change without notice. It is possible for this value to be -1 or 0 within your plug-in code under certain circumstances."

    https://docs.microsoft.com/th-th/dotnet/api/microsoft.xrm.sdk.iexecutioncontext.depth?view=dynamics-general-ce-9

    I think in V9, there seems to be more platform level plugin execution for the same event before yours and that's why the depth value could have changed. Dynamics 365 is much more modular and Sales/Service/Marketing are now separate apps having their own plugins and stuff.  I think this new structure could be the reason for depth change but I would enable plugin trace log and see the plugin steps executed for the same event.  The trace log might give you the answer.

    Personally, I would recommend you remove the dependency on the depth and only do the update if the pre and post field value conditions are met.

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... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans