Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

2 plugins for my crm

Posted on by 75

I have 2 plugins that have method service.create , i would like to block one of them when the other is running because the first one create record and call to service.create and the second hav message create

  • Verified answer
    EranYaron Profile Picture
    EranYaron 140 on at
    RE: 2 plugins for my crm

    Hey,

    Based on what you're saying you have two plugins registered on Contact Create, Plugin A and Plugin B.  Plugin B may create a contact and then you dont want Plugin A to be executed - is that right?

    If it is, you should be looking at the context.Dpeth in the first Plugin - it tells you how deep you are in the rabbit hole, or how many plugins\workflows kicked off before this one.  You can even check the ParentContext to ensure it was kicked off by Plugin B.

    community.dynamics.com/.../ms-crm-ipluginexecutioncontext-depth-a-detailed-look-plugintip1

    Good luck,

    E

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: 2 plugins for my crm

    Hi,

    If I am correctly understood ,you can create dummy two options field in the entity , and set value true  or false while creation.

    Another plugin you simply check the field value and based on that execute  or return from your code.

    You can also try to check context depth and also pass shared variable and set return on plugin which you don't want to execute.

  • Jf Marwen Profile Picture
    Jf Marwen 75 on at
    RE: 2 plugins for my crm

    first plugin triggered when contact was created , the seconde create contact  ,  i dont like to the seconde call to the first

  • Suggested answer
    Kokulan Profile Picture
    Kokulan 18,048 on at
    RE: 2 plugins for my crm

    Hi

    You should be able to set the order of the execution by setting the SDK Message Process Step execution order,

    "Execution order in plugin specifies the order, also known as rank, that plug-ins are executed within a pipeline stage. Plug-ins registered with an order value of 1 are executed first, followed by plug-ins registered with an order of 2, and so on. However, if there is more than one plug-in in a stage with the same order value, then the plug-in with the earliest compilation date is called first"

    https://social.microsoft.com/Forums/en-US/801b104c-387b-40e9-a537-61e2265318db/execution-order-in-plugin-registration-tool?forum=crmdevelopment

    Please follow the links below

    [View:https://community.dynamics.com/crm/b/exploringdynamics365/archive/2017/10/16/workflow-or-plugin-which-one-will-run-first:750:50]

  • Dynamics365 Rocker Profile Picture
    Dynamics365 Rocker 7,755 on at
    RE: 2 plugins for my crm

    Please explain in detail with some example.

    BTW you can not disable/cancel a plugin dynamically but work around is there.

  • Dynamics365 Rocker Profile Picture
    Dynamics365 Rocker 7,755 on at
    RE: 2 plugins for my crm

    Please explain in detail with some example.

    BTW We can not disable/stop a plugin dynamically but work around is there.

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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans