This project depends on the Sdk.Soap.js library included in the Sdk.Soap.js project.

Use actions to define business processes that you can call through code. See Actions for more information. JavaScript is one of the ways that actions can be called through code.

Define actions using the workflow designer in the web application. Use this Sdk.Soap Action Message Generator to generate request and response classes you can use in your code to call the action.

Before you can use this solution, you must install required NuGet packages.

Install NuGet packages

Use the following steps to install the required assemblies for the Sdk.Soap Action Message Generator:

  1. Download the Sdk.Soap Action Message Generator solution files.
  2. Open the Sdk.Soap Action Message Generator.sln solution file using Visual Studio 2013.
  3. In Visual Studio 2013, right-click the Sdk.Soap Action Message Generator project and choose Manage NuGet Packages.
  4. In the search window, search for “Microsoft Dynamics CRM 2013 core assemblies”. Locate the NuGet package described in Microsoft Dynamics CRM 2013 SDK core assemblies.

  5. Click Install. You’ll need to accept the license terms to complete installing this package.
  6. In the search window, search for “AjaxMin” and locate the package described in Microsoft Ajax Minifier.
  7. Click Install to install the package and then close the window.

Generate Request and Response classes for messages

You define actions in your organization, using the workflow designer, before you can generate classes for them. After you have defined the actions, use the following steps to generate a JavaScript library for each class.

  1. In Visual Studio, with the Sdk.Soap Action Message Generator solution open and the necessary NuGet packages installed, press F5.
  2. If you have not previously run one of the Microsoft Dynamics CRM managed code samples before, you’ll need to enter information to run the code, otherwise enter the number for one of the CRM servers you have previously set up.

    Prompt Description
    Enter a CRM server name and port []

    Type the name of your Microsoft Dynamics CRM server. The default is Microsoft Dynamics CRM Online ( in North America.

    Example: myservername

    Example: myprefix.myservername:5500


    Don’t include the name of your organization or Internet protocol (http or https). You’ll be prompted for that later.

    Is this server configured for Secure Sockets Layer (https) (y/n) [n] Type y if the URL you use to access Microsoft Dynamics CRM 2013 begins with https://, otherwise type n. Microsoft Dynamics CRM Online users won’t see this prompt.
    Is this organization provisioned in Microsoft online services (y/n) [n]

    Type y if this is a Microsoft online services provisioned organization. Otherwise, type n.

    Only CRM Online users see this prompt.

    Enter domain\username

    For Microsoft Dynamics CRM 2013, type your network domain and user name separated by a backslash (\). For CRM Online, enter your Microsoft account.

    On-premises/IFD example: mydomain\tadams

    Online example:

    If you just press <Enter> for the user name, the program will look for and use saved credentials. If there are no saved credentials, the program will fail.

    Enter password Type your password. The characters will show as “*” in the window. Your password is securely saved in the Microsoft Credential Manager for later reuse.
    Specify an organization number (1-n) [1] From the list of organizations shown that you belong to, type the corresponding number. The default is 1, indicating the first organization in the list.
  3. For each custom action found in your organization, a pair of corresponding JavaScript libraries will be saved in the \bin\Debug\Messages folder.
    One version will be in the vsdoc folder and a second will be in the min folder. Use the minified version in your production code and the *vsdoc.js version at design time to get IntelliSense support in Visual Studio.
  4. Optional: You can edit the code comments in the *.vsdoc.js file to provide descriptions for the request and response properties so that other developers using the class can view the information with Visual Studio IntelliSense while using the class in their projects.

Example: Sdk.new_CustomAction.vsdoc.js

The following example is a simple custom action named “Custom Action” where the default organization solution publisher is “new”.

The following sample shows the Sdk.new_CustomAction.vsdoc.js file generated for the custom action named “Custom Action”.

  "use strict"; 
(function () { 
this.new_CustomActionRequest = function ( 
/// This is a sample action 
///<param name="inBool"  type="Boolean"> 
/// [Add Description] 
if (!(this instanceof Sdk.new_CustomActionRequest)) { 
return new Sdk.new_CustomActionRequest(inBool); 
  // Internal properties 
var _InBool = null; 
// internal validation functions 
function _setValidInBool(value) { 
 if (typeof value == "boolean"{ 
  _InBool = value; 
 else { 
  throw new Error("Sdk.new_CustomActionRequest InBool property is required and must be a Boolean.") 
//Set internal properties from constructor parameters 
  if (typeof inBool != "undefined"{ 
  function getRequestXml() { 
return ["<d:request>", 
           (_InBool == null) ? "<b:value i:nil=\"true\" />" : 
           ["<b:value i:type=\"c:boolean\">", _InBool, "</b:value>"].join(""), 
        "<a:RequestId i:nil=\"true\" />", 
  // Public methods to set properties 
  this.setInBool = function (value) { 
  /// [Add Description] 
  ///<param name="value" type="Boolean"> 
  /// [Add Description] 
 this.new_CustomActionRequest.__class = true; 
this.new_CustomActionResponse = function (responseXml) { 
  /// Response to new_CustomActionRequest 
  if (!(this instanceof Sdk.new_CustomActionResponse)) { 
   return new Sdk.new_CustomActionResponse(responseXml); 
  // Internal properties 
  var _outBool = null; 
  // Internal property setter functions 
  function _setOutBool(xml) { 
   var valueNode = Sdk.Xml.selectSingleNode(xml, "//a:KeyValuePairOfstringanyType[b:key='OutBool']/b:value"); 
   if (!Sdk.Xml.isNodeNull(valueNode)) { 
    _outBool = (Sdk.Xml.getNodeText(valueNode) == "true") ? true : false; 
  //Public Methods to retrieve properties 
  this.getOutBool = function () { 
  /// [Add Description] 
  ///<returns type="Boolean"> 
  /// [Add Description] 
   return _outBool; 
  //Set property values from responseXml constructor parameter 
 this.new_CustomActionResponse.__class = true; 
Sdk.new_CustomActionRequest.prototype = new Sdk.OrganizationRequest(); 
Sdk.new_CustomActionResponse.prototype = new Sdk.OrganizationResponse();

Use Request and Response classes for actions

The following conditions must be true before you can use request and response classes for actions:

  1. The custom action must be available in the organization.
    If you’re not running the custom action in the same organization in which it was defined, you must export the custom action as part of a solution and install it in the organization where you want to use it.
  2. The custom action must be activated.
    While you can use the Sdk.Soap Action Message generator to generate class files for actions that aren’t yet activated, you can’t use the action until it’s activated.
  3. The custom action signature cannot change.
    You can deactivate a custom action and change some of the parameters of a custom action. However, if you do this, you must regenerate the action classes to reflect these changes.

When these conditions are true, you can use the JavaScript library classes for your custom actions in the same way you use the execute method with the system message classes provided in the Sdk.Soap.js project. See that project for more information about calling messages in your code.