2

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.

Raghu
  • 151
  • 1
  • 13
  • Did you find a solution? Probably should just use `Process.js` library e.g. https://stackoverflow.com/questions/39849476/call-action-using-process-js-crm – Don Cheadle Aug 22 '19 at 22:35

2 Answers2

1

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!

Mark T
  • 190
  • 1
  • 6
  • The OP question is about executing JavaScript to call the Action and how to give it the Target. I.e. the Target is not set automatically, the JS needs to provide it. But how? – Don Cheadle Aug 22 '19 at 22:33
1

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

Andrew Butenko
  • 5,048
  • 1
  • 14
  • 13