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 :
Microsoft Dynamics CRM (Archived)

Plugin for both Account create and update message

(0) ShareShare
ReportReport
Posted on by 145

Hi All,

I have a scenario where i have to trigger a plugin for both create and update of an account. I have written a plugin with create message and now i want to use the same for update. i tried using plugin registration tool but it din't reflect. Please help me with your solutions.   

Thanks & Regards,

Allwyn Christopher

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Brijesh R Profile Picture
    on at

    It seems some issue pertaining to caching. You can re register plugin again and try

  • Suggested answer
    Bas van de Sande Profile Picture
    4,383 on at

    Hi Allwynn,

    did you explicitly specify in the execute method that the plugin has to respond to the create message?  In that case you need to specify as well that it has to respond to the update message.

    The code in that case would look as follows

    public void Execute(IServiceProvider serviceProvider)

    {

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

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

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

       if (context.MessageName == "Create")

       {

          //write the logic what you want this plugin to do on Create

       }

       if (context.MessageName == "Update")

       {

          //write the logic what you want this plugin to do on Update

       }

     }

    Now you should be able to register multiple steps to the same plugin

    I hope this helps you a bit further

    Bas

    p.s.  I wrote a small framework that you can use to simplify your plugin development. You can download it at journeyintocrm.com/.../1053

  • Ozarour Profile Picture
    630 on at

    Could you please copy and paste your code of the execute method ? So that we can help and check if anything is missing

  • Verified answer
    Allwyn Christopher Profile Picture
    145 on at

    Hi All,

    Thanks for your respond. I have achieved this using plugin registration tools provided with CRM SDK. I created Class library and added it in with plugin registration tool.Try using the tool, its doing amazing.

    Thanks And regards

    Allwyn Christopher

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans