Microsoft Dynamics CRM supports two types of parameters for a workflow activity.
- Input Parameters
- Output Parameters
Input Parameters
The input parameter is annotated with the .NET attribute "Input".
DefaultAttribute
DefaultAttribute class can be used to specify a default value (using "Default" attribute) for an input parameter.
Bool
[Input("Bool input")]
[Output("Bool output")]
[Default("True")]
public InOutArgument<bool> Bool { get; set; }
DateTime
[Input("DateTime input")]
[Output("DateTime output")]
[Default("2013-07-09T02:54:00Z")]
public InOutArgument<DateTime> DateTime { get; set; }
Decimal
[Input("Decimal input")]
[Output("Decimal output")]
[Default("20.75")]
public InOutArgument<decimal> Decimal { get; set; }
Double
[Input("Double input")]
[Output("Double output")]
[Default("200.2")]
public InOutArgument<double> Double { get; set; }
Integer
[Input("Int input")]
[Output("Int output")]
[Default("2322")]
public InOutArgument<int> Int { get; set; }
Money (Currency)
[Input("Money input")]
[Output("Money output")]
[Default("232.3")]
public InOutArgument<Money> Money { get; set; }
OptionSetValue
[Input("OptionSetValue input")]
[Output("OptionSetValue output")]
[AttributeTarget("account", "industrycode")]
[Default("3")]
public InOutArgument<OptionSetValue> OptionSetValue { get; set; }
Attribute Target must specify the entity and attribute being referenced.
String
[Input("String input")]
[Output("String output")]
[Default("string default")]
public InOutArgument<string> String { get; set; }
Entity Reference
[Input("EntityReference input")]
[Output("EntityReference output")]
[ReferenceTarget("account")]
[Default("3B036E3E-94F9-DE11-B508-00155DBA2902", "account")]
public InOutArgument<EntityReference> AccountReference { get; set; }
Reference Target attribute must specify the type of entity being referenced.
Required Argument Attribute
System.Activities.RequiredArgumentAttribute class can be used to specify that the input parameter is required.
[RequiredArgument]
[Input("Update next Anniversary date for")]
[ReferenceTarget("contact")]
public InArgument<EntityReference> Contact { get; set; }
Output Parameters
The output parameter is annotated with the .NET attribute "Output"
//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.
public OutArgument<int> CreditScore {get;set;}
Refer to Microsoft documentation for more details
[Input("OptionSetValue input")]
[Output("OptionSetValue output")]
[AttributeTarget("account", "industrycode")]
[Default("3")]
public OutArgument<OptionSetValue> OptionSetValue { get; set; }
Output only:
[Output("OptionSetValue output")]
[AttributeTarget("account", "industrycode")]
public OutArgument<OptionSetValue> OptionSetVal { get; set; }
To set:
this.OptionSetVal .Set(context, new OptionSetValue(intVar)); //change intVar var to yours
DateTime:
[Input("DateTime input")]
[Output("DateTime output")]
[Default("2004-07-09T02:54:00Z")]
public OutArgument<DateTime> DateTimeVal { get; set; }
Output only:
[Output("DateTime output")]
public OutArgument<DateTime> DateTimeVal{ get; set; }
To set:
this.DateTimeVal.Set(context, myDateTimeValue); //change myDateTimeValue var to yours
Money:
[Output("Money output")]
public OutArgument<Money> MoneyVal { get; set; }
To set:
decimal decimalVar = 200.15; //change to your value
this.MoneyVal .Set(context, new Money(decimalVar)); //change decimalvar to yours
Lookup or Entity Reference:
[Output("EntityReference output")]
[ReferenceTarget("account")] //change this to your Entity, for example if you want to lookup to entity Account
public OutArgument<EntityReference> EntityReferenceVal { get; set; }
To set:
Guid accountId = new Guid("6fd72744-3676-41d4-8003-ae4cde9ac282"); //change to your value
this.EntityReferenceVal.Set(context, new EntityReference("account", accountId)); //change the "account" and accountId to your variables (entity name and entity record id of the lookup)
Btw, we also can set default value like this:
[Output("Money output")]
[Default("232.3")]
public InOutArgument<Money> MoneyParameter { get; set; }
Hope it helps!
Thank you.
This blog was making more interesting. Keep adding more information on your page.
ReplyDeleteC C++ Training in Chennai
C Training in Chennai
C++ Training in Chennai
JMeter Training in Chennai
JMeter Training Institute in Chennai
Appium Training in Chennai
javascript training in chennai
core java training in chennai
The innovative thinking of you in this blog. This blog makes me very useful to learn.
ReplyDeleteSelenium Training in Chennai
Best selenium Training Institute in Chennai
selenium testing training in chennai
Selenium Training
Selenium training in porur
Selenium training in OMR
Big data training in chennai
Android Training in Chennai
IOS Training in Chennai
JAVA Training in Chennai
I don’t have any idea about commenting on someone’s blog but it’s the first time I really want to appreciate the hard work of this blog admin for sharing this post with us.
ReplyDeleteSpoken English Classes in Chennai
Spoken English in Chennai
Top 10 Spoken English Classes in Chennai
Best IELTS Coaching in Chennai
IELTS Coaching Centre in Chennai
English Classes in Mumbai
English Speaking Classes in Mumbai
Best IELTS Coaching in Mumbai
IELTS Coaching in Mumbai
Spoken English Classes in Anna Nagar
Thanks
DeleteSuch an amazing blog with new updates. I love to learn more about this topic. Waiting for more like this.
ReplyDeletePHP Training in Chennai
PHP Course in Chennai
PHP Training Institute in Chennai
PHP course
AngularJS Training in Chennai
ReactJS Training in Chennai
Web Designing course in Chennai
PHP Training in Velachery
PHP Training in T Nagar
PHP Training in OMR
When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get three e-mails with the same comment. Is there any way you can remove me from that service? Many thanks!
ReplyDeletepython website development
Truly well post!!! It was a wonderful concept that is very helpful to all readers. Your explanation style is too good. Thank you for your post with sharing.
ReplyDeleteAndroid Training Institute in Chennai | Android Training Institute in anna nagar | Android Training Institute in omr | Android Training Institute in porur | Android Training Institute in tambaram | Android Training Institute in velachery
ReplyDeleteIam so thrilled because of finding your alluring website here.Actually i was searching for Android.Your blog is so astounding and informative too..Iam very happy to find such a creative blog. Iam also find another one by mistake while am searching the same topicIOS Development.Thank you soo much..