MS CRM Workflow: input/output arguments

Some time we need to send out or take inputs for custom workflows dynamically. To do so MS CRM provided input/output arguments, syntax of it is

Input arguments

[Input(“data type input”)]
[Default(“00.00″)]
public InArgument AtrName{ get; set; }

Output arguments
[Output(“data type output”)]
[Default(“00.00″)]
public OutArgument AtrName{ get; set; }

Input and Output argument

[Input(“data type input”)]
[Output(“data type output”)]
[Default(“00.00″)]
public InOutArgument AtrName{ get; set; }

and here is the example

public sealed class ArgumnetExample : CodeActivity
{
[Output(“Decimal output”)]
[Default(“00.00″)]
public InOutArgument FlowCount { get; set; }
protected override void Execute(CodeActivityContext executionContext)
{
//Create the IWorkflowContext and the
IWorkflowContext workflowContext = executionContext.GetExtension();

//IOrganizationService for communication with CRM
IOrganizationServiceFactory serviceFactory = executionContext.GetExtension();
IOrganizationService service = serviceFactory.CreateOrganizationService(workflowContext.UserId);
decimal count = 0;
Do your bussiness
{   }
//return

//it will set out put argumnet
FlowCount.Set(executionContext, count);

//and to collect input argument

dataTypeInput = Atrname.get(executionContext)

//do your
}

}

}

Then register above workflow in MS CRM and get the data in out of box workflow as shown below

WF in-out put That it To explore more use this link

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s