Calling Action with Sdk.Soap.js

December 11, 2014

3 comments

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 Generator.zip and extract it
    2. Download the Sdk.Soap.js library.zip 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.  

Add comment
facebook linkedin twitter email

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

*

3 comments

  1. TonySeptember 14, 2015 ב 1:35 AM

    Hi,
    I try your code in my CRM 2015 Online UR1 solution.
    When I setup Action request ( var handleNewRequest = new Sdk.new_HandleNewLeadRequest(….); ) I get the following error:
    TypeError: Sdk.new_HandleNewLeadRequest is not a construct

    Can you help me?
    Thanks

    Reply
    1. rdtSeptember 16, 2015 ב 8:48 AM

      Hi Tony,

      Does the new_HandleNewLeadRequest class appears in the Action class?

      Reply
  2. Pingback: Executing Custom Action via JavaScript | YanivRDT