Disable All the steps in a Plug

Forum Post: Change the Filter On option on Opportunity Associated View for Account form

In addition to Alex’s answer, just an brief explanation:

Your code basically seems fine with the exception that you are calling a First method after calling the Retrieve Multiple.

You need to do a For Each statement on the Retrieve Multiple Results of the Entity Collection.


EntityCollection steps = orgService.RetrieveMultiple(qe).Entities.Where(x => x.Attributes[“name”].ToString().Contains(pluginName));

foreach (Entity step in steps.Entities)


  Guid stepId = step.Id;

  int pluginStateCode = enable ? 0 : 1;

  int pluginStatusCode = enable ? 1 : 2;

  DeactivateStep (stepId, pluginStateCode, pluginStatusCode);


// function to Deactivate Each Step

private function DeactivateStep(Guid stepId, int pluginStateCode, int pluginStatusCode)


  SetStateRequest request = new SetStateRequest()


     EntityMoniker = new EntityReference(“sdkmessageprocessingstep”, pluginId),

     State = new OptionSetValue(pluginStateCode),

     Status = new OptionSetValue(pluginStatusCode)




Hope this helps.

Source link

Leave a reply

Please enter your comment!
Please enter your name here