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,...
Suggested answer

How to disable a plugin programetically?

(0) ShareShare
ReportReport
Posted on by 5

Hello team,

Is there any way to disable a plugin programetically other then using PRT ?

Before running upgrade scripts I want to disable plugins programetically and run scripts and then enable them after upgrade scripts are executed. Is there any way to do so ?

Thank you!

I have the same question (0)
  • Suggested answer
    mobeenmohsin Profile Picture
    on at
    RE: How to disable a plugin programetically?

    Hi Sangeeta,

    Hope you are doing well.

    It seems that https://docs.microsoft.com/en-us/previous-versions/dynamics-crm4/developers-guide/bb958096%28v%3dmsdn.10%29 is not supported in current version but we can use another method mentioned in below document:

    https://community.dynamics.com/crm/f/microsoft-dynamics-crm-forum/119022/dynamically-programatically-enable-disable-plugin?pifragment-97030=1

    Please help to review the answer given in above document and let us know if any issue. Please help to mark my answer as verified if you are able to solve your problem. Thank you.

    Best Regards,

    Mobeen Mohsin

  • Suggested answer
    Bipin D365 Profile Picture
    28,983 Moderator on at
    RE: How to disable a plugin programetically?

    Hi,

    Use below code to disable plugin steps programatically.

    public static void UpdateStepStatus(CrmOrganization org, Guid stepId, bool isEnable)
    {
        if (org == null)
        {
            throw new ArgumentNullException("org");
        }
        else if (stepId == Guid.Empty)
        {
            throw new ArgumentException("Invalid Guid", "stepId");
        }
    
        SetStateSdkMessageProcessingStepRequest request = new SetStateSdkMessageProcessingStepRequest();
        request.EntityId = stepId;
        if (isEnable)
        {
            request.SdkMessageProcessingStepState = SdkMessageProcessingStepState.Enabled;
        }
        else
        {
            request.SdkMessageProcessingStepState = SdkMessageProcessingStepState.Disabled;
        }
        request.SdkMessageProcessingStepStatus = -1;
        org.CrmService.Execute(request);
    
        return;
    }

    See below link

    https://social.microsoft.com/Forums/en-US/53b93133-4999-44f2-8f49-0d736ac2763a/programmatically-disabling-the-plugin-step?forum=crmdevelopment

    If found helpful, Please mark my answer verified.

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 172

#3
Tom_Gioielli Profile Picture

Tom_Gioielli 116 Super User 2025 Season 2

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans