Development, Howto

Microsoft Dynamics CRM 2013: Actions walkthrough for .Net and JavaScript developers

I believe that almost every developer for Dynamics CRM has faced a scenario where he/she had to invoke some complex logic on a server side, pass parameters and receive a response back. Before CRM 2013, we used workarounds similar to this one. When Dynamics CRM 2013 was released, we got a solution that would not require ‘magic’.
The following posts describe how to create Actions in CRM side:
This is what my Custom Action looks like:

Usage of Custom Actions in .Net:
1. Actions are available for Early binding. To get Early Binding classes, you need to run CrmSvcUtil (you can find this utile in the SDK package, bin folder) using the following command line:

My command sample can also be used for OnPremise deployments. Detailed information regarding generating Early Binding classes for all types of deployments are covered in this article.

Add generated Classes.cs to your project and start using it:

Here is a sample of code that instantiates request, executes it and receives result:

2. If you don’t like or don’t want to use Early binding, you can use OrganizationRequest/OrganizationResponse. Sample of code:

Usage of Actions in JavaScript:

1. Prepare Soap Xml request. The easiest way to do it is to use the SoapLogger application that is the part of the SDK package. Detailed information you can find here. A sample of code that captures request and response follows:

In the output.txt file you can find following:

This is the Soap Xml request you will use.

2. Use this Soap request with CustomAcionExecutor.js library I’ve developed. Here’s a sample of usage:

When you do, you will get a parsed response from the server:



Source code of CustomActionExecutor.js:

UPD For visitors who don’t see download url on top of this message.

Alternative CustomActionExecutor.js download URL.


  1. Hello,

    I do not see a link to download the source of your library. I’m trying to do precisely what you’ve outlined.

    Thanks in advance,

    1. That’s weird. I will upload file directly inside blog and leave download Url inside this post.

  2. Hello,

    Why is that my code for example required

    request[“Target”] = new EntityReference(“account”, entity.Id);
    before I can execute the request?

    1. Cyrus,
      I believe that you created Entity – Related action. In my example I used Global action.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.