Calling Action with Sdk.Soap.js

Microsoft Dynamics CRM 2013/2015 Action mechanism is a basic building block in the SPoI (Single Point of Implementation) approach:

  1. Define Action business logic using native Workflow Steps
  2. If required, complement the Action business logic with Custom Workflow Activity components
  3. Activate the Action from server and client side code

Activating an Action from Client Side is made easy with Sdk.Soap.js infrastructure. here is a short walkthrough:

  1. Define & Activate Action

    Go to Settings –> Processes and define a new Action. When you are done, activate it.

    My sample Action, named e4d_HandleNewLead, handles new Lead process with the following stages:

    1. Creation of new Lead record
    2. Assignment of the Lead record to the proper Team according to Lead’s number of employees
    3. Sending an acknowledgments message to the Lead’s email

    The Action’s input parameters are:

    1. First name
    2. Last name
    3. Subject
    4. Email address
    5. Number of employees
    6. Industry code

    The Action’s only output parameter is the Lead record URL.

    Action details

    Action details

  2. Generate Action class

    1. Download the Sdk.Soap.js Action Message and extract it
    2. Download the Sdk.Soap.js and extract it
    2. Open the VS solution and click F5 to run it
    3. Select the target Organization or feed in a new one
    4. Wait for the program to complete and go to the …\bin\Debug\Messages\vsdoc folder to make sure your Action class has been created successfully
  3. Add required references

    1. Add Sdk.Soap.min.js and your Action minified file into your MSCRM Solution. My Solution prefix is ‘e4d’.
    2. Add script reference to the Sdk.Soap.min.js library into your HTML/Entity form libraries from the ..\Sdk.Soap.js\C#\Sdk.Soap.js folder
    2. Add script reference to your minified Action class into your HTML/Entity form libraries 
    3. Add references to .vsdocs versions of  your libraries to the HTML/JS files to get IntelliSense support

                script references

    script references

  4. Consume Action

1. Declare an Action request object and initiate with required parameters values
2. Execute the request into a response variable and access the response parameters

consume action

Make sure you deploy the minified files in your Solution while using the .vsdocs version in your IDE.  



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s