by Carmel Schvartzman
- In this walkthrough we will learn How-to add INPUT and OUTPUT parameters to a custom plug-in . The parameters are part of the assembly METADATA: the CRM environment uses this metadata at runtime to link our code to the workflow engine. This way we can also declare a parameter as REQUIRED and even set DEFAULT values just in case the user do not provide them.
- Usually, plug-ins need INPUT and OUTPUT parameters. We'll add both of them to our plug-in.
For the INPUT parameter, let's add a public InArgument<string> automatic property:Here we declare our "PluginInput" property to be an InArgument of type string, that the CRM workflow engine will know by the name of "PluginInput" , and which its default value is set as "Default Plugin Input". The parameter name will appear in the workflow form assistant, so that the users can map the attribute as anWe can also state that the input parameter will be required, using the following attribute:
[RequiredArgument]Output parameters are declared the same way as input parameters:
Its also possible to declare input-output parameters:
And it's even possible to send-retrieve to-from a plug-in an ENTITY REFERENCE (take into consideration that in this case we must specify which TYPE is the Entity being referenced):
And in the code, we use this properties the following way:That means, we GET the input string parameter calling the Get<some type >(context) method of the INPUT property, and SET the OUTPUT parameter using the Set(context, <some object>) method of the output parameter.
That's all
Happy programming :-)
No comments:
Post a Comment