简体   繁体   中英

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.

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!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM