次の方法で共有


プロセス クラス、属性、および種類

 

公開日: 2016年11月

対象: Dynamics CRM 2015

ここでは、ユーザー定義活動を操作するために使用できる Microsoft Dynamics 365 内のプロセス クラスと型について説明します。

このトピックの内容

プロセス クラス

属性および Microsoft Dynamics CRM の種類

InputAttribute および OutputAttribute

DefaultAttribute

ReferenceTargetAttribute

AttributeTargetAttribute

RequiredArgumentAttribute

プロセス クラス

プロセス クラスは、Microsoft.Xrm.Sdk.Workflow 名前空間 (Microsoft.Xrm.Sdk.Workflow.dll) で使用できます。 これらのクラスを使用すると、Windows Workflow Foundation 内でカスタム活動を作成してから、その活動を Microsoft Dynamics 365 の [プロセス] 領域または XAML ワークフローで使用できます。 プロセス クラスの詳細については、「Microsoft.Xrm.Sdk.Workflow」を参照してください。

属性および Microsoft Dynamics CRM の種類

Microsoft Dynamics 365 型は、Microsoft.Xrm.Sdk 名前空間 (Microsoft.Xrm.Sdk.dll) にあります。InputAttribute クラスと OutputAttribute クラスを使用して、入力および出力のプロパティに注釈を付けます。

カスタム ワークフロー活動では、以下の型がサポートされています。

InputOutput、および Default 属性を除き、カスタム ワークフロー活動でサポートされる Microsoft Dynamics 365 型には、ReferenceTargetAttributeTarget などの追加の属性を指定する必要があります。 これらの種類については、以降のセクションで説明します。

InputAttribute および OutputAttribute

次のサンプルは、入力属性と出力属性をユーザー定義ワークフロー活動で使用される Money パラメーターに追加する方法を示しています。 ここでは、プロパティに既定値を指定する方法も示しています。

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

DefaultAttribute

DefaultAttribute クラスを使用して、入力パラメーターに既定値を指定できます。 次の例は、Default 属性を使用して型に既定値を設定する方法を示しています。

Bool

[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; }

Double

[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; }

Int

[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; }

OptionSetValue

[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

EntityReference 属性の種類は、ReferenceTargetAttribute クラスを使用して参照されるエンティティの種類を指定する必要があります。 次のサンプルは、入力属性と出力属性を ReferenceTarget 属性を使用してユーザー定義ワークフロー活動で使用される AccountReference パラメーターに追加する方法を示しています。

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

AttributeTargetAttribute

OptionSetValue 属性の種類は、AttributeTargetAttribute クラスを使用して参照されるエンティティの種類を指定する必要があります。 次のサンプルは、入力属性と出力属性を AttributeTarget 属性を使用してユーザー定義ワークフロー活動で使用される OptionSetValue パラメーターに追加する方法を示しています。

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

RequiredArgumentAttribute

System.Activities.RequiredArgumentAttribute クラスを使用して、入力パラメーターを必須のパラメーターとして指定できます。

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

関連項目

ユーザー定義ワークフロー活動 (ワークフロー アセンブリ)
メタデータをカスタム ワークフロー活動に追加する
サンプル: カスタム ワークフロー活動の作成

© 2017 Microsoft. All rights reserved. 著作権