Calling Actions from Plugin in CRM 2016

Calling Actions from Plugin in CRM 2016:

Interesting features Updated  in CRM  is Actions. Actions are the Custom messages which can be created for any entity or globally to perform business operations like create/update/Assign etc. Looking on  first time we get a feeling that it is very similar to Workflow but hold on it’s very different from workflow  or Plugins.

Can be associated with single entity or globally.
Actions support Arguments – Input and Output Arguments.
Can be only called through web service calls Like  JavaScript/Plugins/Web through API calls.
Always runs under the context of the calling user.

 Input Arguments:

These are the parameters which need to be passed during action call. These can be Optional/Mandatory. For Mandatory argument it is necessary to provide some value while calling this action.

Output Arguments:

These are the parameters which can be returned when the action is called. These can be Optional/Mandatory.




Let me create a simple Action on Enquiry entity which has one Input Argument: ProjectName [string]

Flow: Settings > Processes > select Category as Actions > In primary entity > Global.                    Input Parameter- InputData.

new_gb” is the name of the Action which should be referred while calling this through API.


Calling Actions from Plugins

Call this Action from our Plugin. I have a Plugin which fires on Post Create of account  am passing the Input Argument Inputdata Parameter before calling this Action. Once this is called It creates a new contact record.

Flow – Account Created – Plugin Triggered(Create Message-post operation)-Plugin triggered then action will be called passing account name to input data- Action step will create the contact record.

// Calling the Action - new_EnquiryCreateProject
OrganizationRequest req = new OrganizationRequest("new_gb");
req["inputdata"] = account.Attributes["name"].toString(); or "Accountname";
for Global Action No need of Target.
//req["Target"] = new EntityReference("contact", contact.Id);

//execute the request
OrganizationResponse response = service.Execute(req);

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s