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

How to create custom actions in code with SDK

(0) ShareShare
ReportReport
Posted on by

I am playing around with custom actions as a way to fire plugins that do custom business logic we can trigger from an external application. We have it working just fine, but I was wondering if there was a way to define the custom actions using the SDK like we do with custom plugins or web resources. I want to automate it as much as possible like how the .crmregister file automates the registration of plugins. I find it necessary since my plugins depend on those custom actions existing before I deploy them. Any ideas how to accomplish this? Is this where custom xaml workflow projects come into play?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Nuno Profile Picture
    2,005 on at
    RE: How to create custom actions in code with SDK

    Hi,

    Take a look at this resources about how to register an action as an plugin message:

    missdynamicscrm.blogspot.pt/.../crm-2013-register-custom-action-as.html

    deepakexploring.wordpress.com/.../actions-in-crm-2013

  • NailsNickerson Profile Picture
    10 on at
    RE: How to create custom actions in code with SDK

    Thanks.  But as you said "the key is to have a plugin registered against that action".  This is precisely the part that isn't clear to me.

    How is a plugin registered against an action?  What entity is the plugin registered to?  What are the messages?  I understand that messages can be created.  How is this done?

    Are there any MSDN pages on the process of creating a message for an action, and then using that to register a plugin against the action?

    Thanks again for any advice.

  • Suggested answer
    Community Member Profile Picture
    on at
    RE: How to create custom actions in code with SDK

    This is a pretty old thread, but I was reading this the other day regarding custom actions and in case anyone else is wondering or you haven't found an answer yet. Here you go.

    msdn.microsoft.com/.../dn481600.aspx

  • Community Member Profile Picture
    on at
    RE: How to create custom actions in code with SDK

    Calling a custom action is pretty easy, I simply followed this:
    http://stackoverflow.com/questions/20577698/crm-2013-calling-actions-from-javascript

    The action will fire, but the key is to have a plugin registered against that action.

  • NailsNickerson Profile Picture
    10 on at
    RE: How to create custom actions in code with SDK

    Sorry I can't answer your question about how to create custom actions using the SDK.

    But I see you've got a good understanding of how custom actions can be used to fire plugins.  Would you be able to explain exactly how this is done?  Many thanks.

  • Community Member Profile Picture
    on at
    RE: How to create custom actions in code with SDK

    Actually the opposite. We created the custom action only to be able to trigger a plugin. The plugin knows nothing about the custom action other that its the event it is listening for. We have that all working, and we had to create that custom action thru the CRM user interface. What we would prefer to do is automate the creation of the custom action by adding it to our visual studio solution where we built the plugins. This way when we deploy the plugins using visual studio, it could create the custom action rather than having to do it manually thru the UI.

    For example we have a custom entity called SalesOffice. We created a custom action called "UpdateSurvey" for that entity which has no workflow steps, only parameters that allow me to pass it some data.  

    Next we created a custom plugin for the SalesOffice -> UpdateSurvey action that will be fired when we call that custom action thru the web service. That plugin takes the data passed to it from the custom action and does a dozen different operations that we want to succeed or fail as an atomic transaction.

    We went this route because we created an external application that simplifies a very complex operation and saves it all in one shot using our custom plugin. Without it, we would have had to do the same thing using 12 different screens in CRM. This was the only way we had found so far where we could affect multiple records as a single transaction thru the web service. If there is another approach that is easier I would be interested to hear it.

  • Mahadeo Matre Profile Picture
    17,021 on at
    RE: How to create custom actions in code with SDK

    Hi JRodman,

    I am interpreting your question is like you have plugin and in that plugin you need to call custom action, and you want to create custom action using code..

    but you dont need to create custom action using code.. you can create action using CRM UI like you are creating workflow. 

    When you go to CRM customization section, and creating new process, you need to select category as Action, and specify entity, then you can add conditions, create / update records, assign etc.. its more similar to workflow. 

    only thing is that we cannot call directly action.. you need to call action either in plugin, workflow, javascript or using CRM sdk.

    Here are details about how to create custom action

    msdynamicscrmblog.wordpress.com/.../actions-in-dynamics-crm-2013

    deepakexploring.wordpress.com/.../actions-in-crm-2013

    blog.sonomapartners.com/.../crm-2013-custom-actions-the-end-of-configuration-entities.html

    inogic.com/.../introduction-to-actions-in-crm-2013

    a33ik.blogspot.com/.../custom-actions-walkthrough-for-net-and.html

    Here is how you can create custom action using code

    msdn.microsoft.com/.../dn481600(v=crm.6).aspx

    and also above links gives details about how to call custom action in plugin.

    Hope this will help you to solve your problem.

  • Community Member Profile Picture
    on at
    RE: How to create custom actions in code with SDK

    In my situation I needed to fire a plugin that allows us to create/update a set of records as an atomic transactional batch, rather than one by one thru the odata web service. The types of logic we have in the plugin we found we could not do in a workflow. We used a custom action to trigger that plugin and call that custom action thru the organization web service. Now we just need a way to create that custom action in our visual studio project, similar to how we register our plugins using the .crmregister file. I was hoping there was a way to do this.

  • Wayne Walton Profile Picture
    13,728 on at
    RE: How to create custom actions in code with SDK

    Hmm, would Custom Workflow Activities be a better solution for you than custom actions?  I haven't tried to fire an action from workflow, but custom activities are supported just fine: msdn.microsoft.com/.../gg309745.aspx

  • Community Member Profile Picture
    on at
    RE: How to create custom actions in code with SDK

    Any ideas?

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
Christoph Pock Profile Picture

Christoph Pock 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans