Looking for PowerObjects? Don’t worry, you’re in the right place! We’ve been part of HCL for several years, and we’ve now taken the final step in our acquisition journey: moving our website to the HCL domain. Nothing else is changing – we are still fanatically focused on Microsoft Business Applications!

HCLTech Microsoft Business Applications Practice Blog

for Dynamics 365, Power Platform and the rest of the Microsoft technology stack

Custom Action Quick Tips

Post Author: HCLTech |

As we already know, Actions are very powerful components that can be leveraged within Dynamics 365. Today's blog will give you quick tips on how Actions can be utilized. Let's jump right in…

Actions can be used to avoid custom coding (plugins or custom workflows).

Accessing data that is specific to a lookup (relationship) on an entity using the out-of-the-box workflows does not work on its own. But with actions, is completely possible.

Scenario: On Update of Account you have the check if the related Primary Contact's custom lookup's (an address record) state field is "WA" and populate that on the Account entity. This relation has a greater depth that cannot be reached with just a workflow.

  • Create a custom action, None (global), with an Entity Reference Input Parameter for Address entity and an Entity Reference to the Account Entity
  • Within the custom action, add a check condition to verify the Input Address has the state as "WA" and if that is true then update the state on the Account using the Account Input Parameter
  • Create a workflow that triggers on Update of Account entity
  • Select the Perform Action and pass the Address lookup from the Contact which can be accessed from the related records of the Account entity
  • And pass the account record itself as the second Input Parameter

Activate both the processes. Now create dummy data to verify this process. Go ahead and trigger the Update which will run the workflow record, the workflow will pass the Address from the Contact record and the account record to the custom action. The custom action will now process the logic since it already has the address lookup in it, if the state is "WA" the next step will be to update that on the Account record using the second input parameter.

The Input parameters on the custom action can be made as required so that there is validation when the workflow calls it. This scenario would have lead into a custom code component if we did not have the custom action. Below you will find the screen shots of the Workflow and the Custom Action.

Note: You can always add extra conditions to check if the field contains data in order to avoid null exceptions(object reference exceptions)

Workflow screen shots:

The first screenshot explains the setup of the workflow and the second is how to pass the data to the action.

Custom Action Quick Tips

Custom Action Quick Tips

Action Screen Shots:

The first screenshot is the setup of the custom action. Second and third screenshots just show the detailed definitions of the Input Parameters.

Custom Action Quick Tips

Custom Action Quick Tips

Custom Action Quick Tips

As always for any CRM questions you can reach out to the PowerObjects team by clicking here.

Happy CRM'ing!

By Joe D365
Joe D365 is a Microsoft Dynamics 365 superhero who runs on pure Dynamics adrenaline. As the face of PowerObjects, Joe D365’s mission is to reveal innovative ways to use Dynamics 365 and bring the application to more businesses and organizations around the world.

PowerObjects Recommends