Creating and Executing a Custom Action and Early Bound Class in Dynamics 365 A Step-by-Step Guide

Creating and Executing a Custom Action and Early Bound Class in Dynamics 365 A Step-by-Step Guide

Introduction

In this blog post, we'll walk you through the process of creating and executing a custom action and Early Bound Class in Dynamics 365. We'll cover everything from creating the custom action and generating early bound classes to writing the plugin code and executing the action via workflow. Let's get started!


Creating the Custom Action

The first step in our process is to create a custom action with the necessary input and output parameters. This allows us to define the operation we want to perform and specify the data that will be used and returned.


Steps:

1. Navigate to the Solution in Dynamics 365.

2. Create a new Action in the Processes section.

3. Define the Input and Output parameters. For this example, we used:

    - Input Parameters: Money1 Type (Money), Money2 Type (Money), Target Type (Entity Reference)

    - Output Parameter: MoneySum Type (Money)


Creating and Executing a Custom Action and Early Bound Class in Dynamics 365 A Step-by-Step Guide

Generating Early Bound Classes

Next, we need to generate early bound classes using the XRM Toolbox.


Steps:

1. Open XRM Toolbox and open the Early Bound Generator V2 Tool.

2. Add the custom action to the Message Whitelist.

3. Generate the early bound classes.


Generating Early Bound Classes in dynamcis CRM


Writing the Plugin Code in dynamics CRM

Writing the Plugin Code

With the early bound classes in place, we can now write the plugin code to perform the functionality. This involves calculating the sum of the input money values and setting the result in the output parameter.


Steps:

1. Create a new class that implements the IPlugin interface.

2. Retrieve and validate the input parameters.

3. Perform the sum calculation.

4. Set the result in the output parameter.

5. Register the plugin.

 

Here’s a snippet of the plugin code:


CSharp (C#):


Writing the Plugin Code with c# sharp language in Dynamics CRM


Article content

Registering the Plugin

After writing the plugin code, the next step is to register the plugin using the Plugin Registration Tool.


Steps:

1. Open Plugin Registration Tool.

2. Register the new plugin assembly.

3. Add a step for the plugin and set the message to the custom action created earlier.


Registering the Plugin in Dynamics CRM

Executing the Action via Workflow

Finally, we use a workflow in Dynamics 365 to trigger the custom action. This allows us to automate the execution of our custom actions based on specific criteria.


Steps:

1. Create a new Workflow in Dynamics 365.

2. Add a step to Perform Action.

3. Set the input fields with the appropriate values, including the quote entity reference.


Executing the Action via Workflow in Mirocsoft Dynamics CRM

Conclusion

By following these steps, you can create and execute a custom action in Dynamics 365. This process involves creating the action, generating early bound classes, writing the plugin code, registering the plugin, and finally, triggering the action via workflow. With these tools and techniques, you can extend the functionality of Dynamics 365 to meet your unique business requirements.

SkySoft Connections is a software solution company that was established in 2016. Our quality services begin with experience and end with dedication. Our directors have more than 15 years of IT experience to handle various projects successfully. Our dedicated teams are available to help our clients streamline their business processes, enhance their customer support, automate their day-to-day tasks, and provide software solutions tailored to their specific needs. We are experts in Dynamics 365 and Power Platform services, whether you need Dynamics 365 implementation, customization, integration, data migration, training, or ongoing support.

To view or add a comment, sign in

More articles by SkySoft Connections

Others also viewed

Explore content categories