web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer Service forum

Where to find input/output parameters for a Plugin?

(0) ShareShare
ReportReport
Posted on by

hiya, does anyone know where to find the XRM documentation which tells me the input/output parameters for any of the plugin messages.

I'm interested in messages like Assign, Grant Access etc..  What parameters are expected to be found in the target ?

thanks a bunch,

Michelle

  

Categories:
I have the same question (0)
  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi ShellyCodes,

    You can find a list of plugin messages in the Message-entity support for plug-ins Excel document found in the CRM SDK. The parameters in the target entity will vary based on the selected entity.

    In your plugin code, you can create an instance of the IPluginExecutionContext.

    IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

    With the context, you can access all the input parameters that are transferred to the plugin.

  • LeoAlt Profile Picture
    16,331 Moderator on at

    Hi partner,

    You could go to there to download SDK for dynamics 365(v9.x).

    Here is a sample about how to assign record.

    https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/sample-assign-record-team

    Hope it helps.

    Best Regards

    Leo

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    The input parameter contains the entity instance (in most of the cases). To get the message name, you need to use context.MessageName. Here is the sample plugin with all the required properties:

    ============

    public void Execute(IServiceProvider serviceProvider)

           {

               if (serviceProvider == null)

                   throw new ArgumentNullException("serviceProvider");

               var context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));

               var serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));

               var tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));

               var service = serviceFactory.CreateOrganizationService(context.UserId);

               var adminService = serviceFactory.CreateOrganizationService(null);

               var messageName = context.MessageName.ToLowerInvariant();

               if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)

               {                

                   Entity targetEntity = (Entity)context.InputParameters["Target"];

                  // Your plugin logic

               }

           }      

    ============

    Hope this helps.

  • Community Member Profile Picture
    on at

    hi Ravi, I'm sorry I didnt make it clear.

    How do we discover for any message what the required input parameters are ?  For example the GrantAccess message requires the target be filled and the principal access. Where is this documented?

  • Suggested answer
    RaviKashyap Profile Picture
    55,410 Moderator on at

    Hi,

    Are you looking for what will be the return value of target? if yes, I don't this level of information is documented.This is something you need to try and find out.

    For grantaccess plugin, you can refer this blog: community.dynamics.com/.../plugin-triggered-when-share-unshare-crm-c

    What is your actual business requirement?

    Hope this helps.

  • Suggested answer
    Adrian Begovich Profile Picture
    1,027 Moderator on at

    Hi ShellyCodes,

    I recommend reading this article as it is helpful for understanding the data context passed to a plugin.

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 > Customer Service

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans