Export (0) Print
Expand All

Process classes, attributes, and types

Applies To: Microsoft Dynamics CRM 2013, Microsoft Dynamics CRM Online

This topic provides information about the process classes and types found in Microsoft Dynamics CRM that you can use to work with the custom activities.

Process classes

The process classes are available in the Microsoft.Xrm.Sdk.Workflow namespace (Microsoft.Xrm.Sdk.Workflow.dll). You can use these classes to create custom activities in Windows Workflow Foundation, and then use the activities in the Processes area of Microsoft Dynamics CRM, or in the XAML workflows. For detailed information about the process classes, see Microsoft.Xrm.Sdk.Workflow.

Attributes and Microsoft Dynamics CRM types

The Microsoft Dynamics CRM types are found in the Microsoft.Xrm.Sdk namespace (Microsoft.Xrm.Sdk.dll). Use the InputAttribute and OutputAttribute classes to annotate input and output properties.

The following types are supported for custom workflow activities:

Apart from the Input, Output, and Default attributes, some of the supported Microsoft Dynamics CRM types in the custom workflow activities require you to specify additional attributes such as ReferenceTarget and AttributeTarget. These are described below.

InputAttribute and OutputAttribute

The following sample shows how to add the input and output attributes to a Money parameter used in a custom workflow activity. It also shows how to specify a default value for the property.

[Input("Money input")]
[Output("Money output")]
[Default("232.3")]
public InOutArgument<Money> MoneyParameter { get; set; }

DefaultAttribute

You can use the DefaultAttribute class to specify a default value for an input parameter. The following examples show how to set the default value for each type using the Default attribute.

[Input("Bool input")]
[Output("Bool output")]
[Default("True")]
public InOutArgument<bool> Bool { get; set; }

[Input("DateTime input")]
[Output("DateTime output")]
[Default("2004-07-09T02:54:00Z")]
public InOutArgument<DateTime> DateTime { get; set; }

[Input("Decimal input")]
[Output("Decimal output")]
[Default("23.45")]
public InOutArgument<decimal> Decimal { get; set; }

[Input("Double input")]
[Output("Double output")]
[Default("252.2")]
public InOutArgument<double> Double { get; set; }

[Input("EntityReference input")]
[Output("EntityReference output")]
[ReferenceTarget("account")]
[Default("3B036E3E-94F9-DE11-B508-00155DBA2902", "account")]
public InOutArgument<EntityReference> EntityReference { get; set; }

[Input("Int input")]
[Output("Int output")]
[Default("2322")]
public InOutArgument<int> Int { get; set; }

[Input("Money input")]
[Output("Money output")]
[Default("232.3")]
public InOutArgument<Money> Money { get; set; }

[Input("OptionSetValue input")]
[Output("OptionSetValue output")]
[AttributeTarget("account", "industrycode")]
[Default("3")]
public InOutArgument<OptionSetValue> OptionSetValue { get; set; }

[Input("String input")]
[Output("String output")]
[Default("string default")]
public InOutArgument<string> String { get; set; }

ReferenceTargetAttribute

The EntityReference attribute type requires you to specify the entity type being referenced using the ReferenceTargetAttribute class. The following sample shows how to add the input and output attributes to an AccountReference parameter in a custom workflow activity by using the ReferenceTarget attribute.

[Input("EntityReference input")]
[Output("EntityReference output")]
[ReferenceTarget("account")]
[Default("3B036E3E-94F9-DE11-B508-00155DBA2902", "account")]
public InOutArgument<EntityReference> AccountReference { get; set; }

AttributeTargetAttribute

The OptionSetValue attribute type requires you to specify the entity and the attribute being referenced using the AttributeTargetAttribute class. The following sample shows how to add the input and output attributes to an OptionSetValue parameter in a custom workflow activity by using the AttributeTarget attribute.

[Input("OptionSetValue input")]
[Output("OptionSetValue output")]
[AttributeTarget("account", "industrycode")]
[Default("3")]
public InOutArgument<OptionSetValue> OptionSetValue { get; set; }

RequiredArgumentAttribute

You can use the System.Activities.RequiredArgumentAttribute class to specify that an input parameter is required.

[RequiredArgument]
[Input("Update Next Birthdate for")]
[ReferenceTarget("contact")]
public InArgument<EntityReference> Contact { get; set; }

See Also

Microsoft Dynamics CRM 2013 and Microsoft Dynamics CRM Online
Send comments about this topic to Microsoft.
© 2014 Microsoft Corporation. All rights reserved.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft