Search This Blog

Saturday, April 16, 2022

DYNAMICS 365 ACTIONS

 Actions in Dynamics 365 are a capability to create business logic that can be called in different ways such as through code or a workflow. They are not run on demand or automatically, but rather they are triggered by processes or code. If you wanted to run an action on demand you could call it from an on demand workflow. Actions take input, do something and may produce output.

Let’s go through an example of creating an action. Let’s say when a case is created where the title contains the word “bug”, we want to send an email to a developer, and assign the case record to the developer. Generally, we could write a workflow to perform these steps and run it on creation of the case. However, what if we want to not have it triggered when a case is created, but we want to run it from code as well, say from JavaScript or C#? We can bundle that functionality into an action and have it called from our front end or plugin code.

Writing the action itself is straight forward. Go to Processes:

Select new and create a new Action for our case:

The window will open:

Note the Process Arguments section. This is the input for our action. As we will be sending an email, we can have a to and from email address here. Add a ToEmail and FromEmail field. These will be EntityReference fields to the User entity:

Now we can add some steps:

Add a Check Condition for the title:

Add the Send Email step and configure the email to use the input parameters:

Then assign the case to the developer:

The action should now look like this:

Activate the action. Now, we will create a Workflow to test the action:

Enter the parameters for the action:

Activate the workflow.

Now, create a case.

After saving the case, the case is reassigned to the developer and an email is sent:


No comments:

Post a Comment