PL 400 : develop a plug-in that targets a custom action message (Create a plug-in)

In the Microsoft Dataverse, there are many processes that run in the background. Normally, such processes work for business automation. In Dynamics CRM 2013, Microsoft introduced a new feature called Actions. It is a type of process that composes the multiple custom business logics in the single message. Action is the type of message that can be defined for the table or globally and is used to extend the standard functionality of the Microsoft Dataverse platform. With Actions, business users can implement business logic, and then developers can associate those actions with platform events.

An Action is process which wrapper for multiple server-side operations.


Actions provide the ability to define a single message that corresponds to an operation that needs to be performed for the business. These new messages are driven by a process or behavior rather than what can be done with the table. In the early period, messages were limited in scope that could be implemented by plugins or custom workflows, but Actions give the ability to define custom actions and perform operations.

Custom Process Actions provide a no-code way to define a custom message using the Workflow designer. 

Custom Process Actions are request and response classes that can be used in the execute method of the CRM Organization service. There are two ways to extend Custom Process Actions using code: with custom workflow activities or by registering plug-ins on stages. In this article, we will discuss about Custom Process Action implementation under the plugin.



We have to make sure the custom process action is activated, otherwise, we will get a runtime error. The input parameters of the plugin context should receive the input arguments defined, and post-operation should have both input and output arguments defined in the actions.

public class CustomActionTestClass : IPlugin
    {
        public void Execute(IServiceProvider serviceProvider)
        {
            IPluginExecutionContext context =
                (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
            IOrganizationServiceFactory factory =
                (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
            IOrganizationService service =
                factory.CreateOrganizationService(context.UserId);
            var IsBoolValue = (string)context.InputParameters["IsInputBool"];           
        }
    }

Comments

Popular posts from this blog

PCF vs. Web Resources: Choosing the Right Extensibility Tool for Dataverse

Is Debt Prosperity or Trap?

Exam PL-400: Microsoft Power Platform Developer