Microsoft Dynamics CRM 2013 Custom Action – A Single Implementation Point

March 16, 2014

Microsoft Dynamics CRM 2013 introduced a new member in the Processes family: Custom Actions.
I see great potential in this new feature, especially as it can be easily executed (synchronously or a-synchronously) from client side code and return results. While Synchronous Workflow can also be executed from client side code, it can’t return results in an elegant manner.

This Custom Action capability enables both server side and client side to share a single implementation point. Here is an example:

Lets say that whenever a Contact record is created, the government id number must be validated (9 digits that adhere to a specific algorithm). Contacts are created manually by users but also programmatically as part of a scheduled integration with an external application.

User experience considerations dictate a client side validation, as we want to warn the user about an invalid value when he changes the field value rather than when when saving the record.
But what about the records created programmatically? We have to add another point of implementation in the form of a Plugin or a Synchronous Workflow to support that.
So we end up with two implementation points, both JavaScript code and a server side component code. This means more development and maintenance efforts.

Let’s review a different solution approach using Custom Action:

  1. Develop a ‘IDValidation’ Custom Workflow Activity to preform the required validation and return a Boolean (valid/invalid) result.
  2. Wrap the IDValidation’  Custom Workflow Activity with a Custom Action and call the Custom Action from JavaScript onchange event (see Andrii’s useful solution here).
  3. Call the Custom Action directly from your server side integration code or wrap the Custom Workflow Activity with a Synchronous Workflow to support records created programmatically

This approach uses a single custom code component consumed both from server and client side, therefor reducing development and maintenance efforts.

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>



  1. NatrajJuly 8, 2014 ב 5:01 AM

    probably bit too late to post a comment. But will try anyway. How do you actually set the value for a EntityCollection parameter in an action using this technique? My scenario is this: Action with 2 input params and 1 output param. The output param is EntityCollection. I have a custom workflow activity in the Action. The custom workflow activity can access the Action Input Parameter, but cannot set a value to the EntityCollection output parameter of the Action. How can I do this? I already posted this ( in forums and don’t have any responses. Any help will be awesome. Thank you.

  2. Pingback: Calling Action with Sdk.Soap.js | YanivRDT

  3. Pingback: Calling Action with Sdk.Soap.js | Yaniv Arditi