Showing posts with label Output Parameters. Show all posts
Showing posts with label Output Parameters. Show all posts

Wednesday, July 29, 2009

How to use Parameters in Workflows/Plugins

CRM Plugins and Workflows provide the ability to pass external information to the plugins as well as receive information from plugin that can be used for further processing.

Plugins:


In case of Plugins, you can use the Secured Parameter and Unsecured Parameter that is available during Plugin registration to pass static information that can be used by the Plugin.
It is better to use the unsecured parameter as this is available in offline as well.


These parameters are available as parameters to the constructor of the Plugin.


public class AccountCreateHandler: IPlugin
{
public AccountCreateHandler(string unsecure, string secure)
{
// Do something with the parameter strings.
}
public void Execute(IPluginExecutionContext context)
{
// Do something here.
}
}

Workflows:

Workflows are allow for Input as well as Output Parameters. You can use the Input Parameters to pass static information to the Workflows. The Output parameter feature of Workflow is very interesting. The Output parameter defined in the Workflow Plugin, becomes available in the CRM Workflow window. You can use this output parameter in any of the Workflow steps.
It can be used in Wait/If condition block as a value to be checked for.




It can also be used in Create/Update step. Here the Output parameter becomes available only for the attributes that match the parameter data type.



If you had some complex logic to be evaluated before you decide who to assign the records to… you can create a Lookup type of Output parameter and assign the record to this.