简体   繁体   中英

How to find respective Entity and Field of Plug-in CRM

I need to know all the plugins attached to particular Entity and its Fields?

I have fetch all the plugins. Below is the code where I fetch all the plugins.

public void retrievePlugin()
        {
            QueryExpression q = new QueryExpression("plugintype");

            q.ColumnSet = new ColumnSet() { AllColumns = true };
            EntityCollection ec = serviceProxy.RetrieveMultiple(q);


        }

I believe you need not plugins but their steps. So the entity you should fetch is sdkmessageprocessingstep and not plugintype. To get steps registered for a particular entity you will need to get ObjectTypeCode of that entity and use it as a filter by primaryobjecttypecode field of linked sdkmessagefiter entity. In other words to get plugin steps registered to handle messages related to account you can use following FetchXml:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="sdkmessageprocessingstep">
    <attribute name="name" />
    <attribute name="description" />
    <attribute name="eventhandler" />
    <attribute name="impersonatinguserid" />
    <attribute name="supporteddeployment" />
    <attribute name="statuscode" />
    <attribute name="statecode" />
    <attribute name="sdkmessagefilterid" />
    <attribute name="sdkmessageid" />
    <attribute name="filteringattributes" />
    <attribute name="configuration" />
    <attribute name="asyncautodelete" />
    <link-entity name="sdkmessagefilter" from="sdkmessagefilterid" to="sdkmessagefilterid" alias="a1">
      <attribute name="secondaryobjecttypecode" />
      <attribute name="primaryobjecttypecode" />
      <filter type="and">
        <condition attribute="primaryobjecttypecode" operator="eq" value="1" />
      </filter>
    </link-entity>
  </entity>
</fetch>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM