The following sample workflow activity demonstrates how to return a calculated value from an activity.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Crm.Workflow; | |
using Microsoft.Crm.Sdk; | |
using Microsoft.Crm.SdkTypeProxy; | |
using Microsoft.Crm.Sdk.Query; | |
namespace SampleWorkflows | |
{ | |
[CrmWorkflowActivity("Return a Calculated Value")] | |
public class AddActivity : Activity{ | |
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext){ | |
result = new CrmNumber(a.Value + b.Value); | |
return base.Execute(executionContext); | |
} | |
public static DependencyProperty aProperty = | |
DependencyProperty.Register("a", typeof(CrmNumber), typeof(AddActivity)); | |
[CrmInput("a")] | |
public CrmNumber { | |
get { return (CrmNumber)base.GetValue(aProperty); } | |
set { base.SetValue(aProperty, value); } | |
} | |
public static DependencyProperty bProperty = | |
DependencyProperty.Register("b", | |
typeof(CrmNumber), | |
typeof(AddActivity)); | |
[CrmInput("b")] | |
public CrmNumber b { | |
get{ return (CrmNumber)base.GetValue(bProperty);} | |
set{ base.SetValue(bProperty, value); } | |
} | |
public static DependencyProperty resultProperty = | |
DependencyProperty.Register("result", typeof(CrmNumber), typeof(AddActivity)); | |
[CrmOutput("result")] | |
public CrmNumber result { | |
get { return (CrmNumber)base.GetValue(resultProperty); } | |
set { base.SetValue(resultProperty, value); } | |
} | |
} | |
} |