Raghu
Raghu

Reputation: 151

How to Pass "Target" argument for a custom Action in CRM Dynamics

I've created a custom action that will be triggering a plug-in on the action's name (Action name used as a message), from the form ribbon button. So basically almost all plug-ins will use the Target entity object from the executionContext.inputparameters["Target"]. I've read that "Target" keyword for the parameters is reserved in the Actions.

My question is- In order to pass the Target object to the action so that it can be used / available in the plug-in, do I need to exclusively create the "Target" argument and pass value to it in the Action invocation (from ribbon button - javascript)?. How can i pass Target argument so that it's available for the Plug-in since no images are available for the custom messages. Does the type need to be an EntityReference or Entity. Any help appreciated.

Upvotes: 2

Views: 6464

Answers (2)

Andrew Butenko
Andrew Butenko

Reputation: 5446

Everything depends how you call your action. If you call it using Soap - yes, Target should be one of Parameters you pass. Something similar to following - https://community.dynamics.com/crm/f/117/t/157959 or https://deepakexploring.wordpress.com/tag/calling-actions-from-javascript-in-crm-2013/

If you plan to use WebApi approach is a bit different - https://community.dynamics.com/crm/b/nishantranaweblog/archive/2017/05/27/sample-code-to-call-action-using-web-api-in-crm

Upvotes: 1

Mark T
Mark T

Reputation: 190

The target will be set automatically. When you created your action you had to choose which entity to base it on. When you trigger your action against a record you'll receive all of the parameters you've defined within the action including an additional Target parameter giving you a reference to the record the action was executed against.

Hope that helps!

Upvotes: 1

Related Questions