Web Development
Published December 02nd, 2016 by

How Dynamics CRM Developers Parameterize Their Workflow?


For dynamics CRM developers, workflow is a robust tool that helps them to write complex business logic processes without creating single programming line. In this article, developers will explain the way they parameterize their workflow.


Workflow is very powerful tool which highly used in MS Dynamics CRM. You can write complex business logic processes without writing single line of programming. You can use “if then else” condition, create or update record, send email, wait condition, change status of record and many more other operations.

To make the workflow more powerful, Microsoft providing on more functionality in which you can add your custom code assembly in workflow. For developer, customer workflow is more sufficient way to achieve really difficult specifications. Also in this custom code, you can add input and output parameters same as some method parameters.

Today we are discussing about Input – Output parameters which can be used in custom workflow assembly to simplify the business logic.


Description about Problem:

How to use Input – Output parameters in CRM custom workflow assembly.


Small things which make big difference. Yes this is what you can say about Input – Output parameters. Input parameter will help workflow to get the value which is assigned into related parameter.

You can get the value of related parameter by using below code.


You can declareInput parameters in your custom workflow assembly as listed data below.

Input Parameters

Using “Input” keyword, we can declare input parameter.


If you want to use default value for an attribute, use “Default” keyword and define the value for the parameter.


[Input("Bool input")]
 publicInArgument Bool { get; set; }


[Input("DateTime input")]
 publicInArgument Date { get; set; }


[Input("Decimal input")]
 publicInArgument Decimal { get; set; }


[Input("Double input")]
 publicInArgument Double { get; set; }


[Input("Int input")]
 publicInArgumentInt { get; set; }

Money (Currency)

[Input("Money input")]
 publicInArgument Money { get; set; }


[Input("OptionSetValue input")]
 [AttributeTarget("account", "industrycode")]
 publicInArgumentOptionSetValue { get; set; }

NOTE: Attribute Target must specify the entity and attribute being referenced.


[Input("String input")]
 [Default("My name as default string value")]
 publicInArgument String { get; set; }

Entity Reference

[Input("EntityReference input")]
 [Default("4AA33D4F-53DF-E511-80C5-002481D2A0DB", "contact")]
 publicInArgumentContactReference { get; set; }

NOTE: Reference Target attribute must specify the type of entity being referenced.

Required Argument Attribute

You can also set Parameter as required using below piece of code.
System.Activities.RequiredArgumentAttribute class can be used to specify that the input parameter is required.

 [Input("Update next Anniversary date for")]
 publicInArgument Contact { get; set; }

Output Parameters

Using “Output” keyword, we can declare output parameter. The Output parameter feature of custom Workflow assembly is very interesting. The Output parameter defined in the custom Workflow assembly, becomes available in the CRM Workflow window. You can use this output parameter in any of the Workflow steps.

You can use Output parameter in various ways like in Wait/If condition block or in Create/Update etc. You can declare output parameters in your custom workflow assembly as listed data below.

//this is the name of the parameter that will be returned back to the workflow
 [Output("Credit Score")]
//this line identifies the specific attribute which will be passed back to the workflow
 [AttributeTarget(CustomEntity, "new_creditscore")]
//this line declares the output parameter and declares the proper data type of the parameter being passed back.
 publicOutArgumentCreditScore {get;set;}

You can also declare parameter as Input and Output both.

In the following code example, IntParameter is the input as well as the output parameter.

[Input("Int input")]
 [Output("Int output")]
 publicInOutArgumentIntParameter { get; set; }

Some types, such as EntityReference and OptionSetValue, require additional attributes apart from the Input, Output, and Default attributes.

The additional attributes are: ReferenceTarget and AttributeTarget. The following sample shows the definition of a parameter of the EntityReferencetype.

[Input("EntityReference input")]
 [Output("EntityReference output")]
 [Default("3B036E3E-94F9-DE11-B508-00155DBA2902", "contact")]
 publicInOutArgumentContactReference { get; set; }


It is difficult to manage some custom business logic in manual workflow in that circumstance custom workflow assembly is a real hero! You can use input parameter to minimize your code and also user the output parameter in next step of your workflow.

Once you will start using Input – Output parameter, you will really like it to manage the code in proper manner and lot of extra efforts to manage the value will remove.

Once you parameterize the workflow in CRM, you can achieve difficult specifications with an ease. Dynamics CRM developers have shared this article to make you understand why workflow matters to them and why it has to be parameterized.

Ethan Millar

Technical Writer at Aegis Softtech
Having more than 6+ years of experience to write technical articles especially for Hadoop, Big Data, Java, CRM and Asp.Net at Aegis Softtech.

Our rankings are completely independent, transparent, and community driven; they are based on user reviews and client sentiment. These web development companies had to earn their way up and didn't just pay their way up.

View Rankings of Best Web Development Companies