SDK を使用して CRM 2011 のプラグインを作成しています。プラグインは、操作後のプラグインとして同期的に実行することを意図しています。プラグインは、2 つの属性を取得し、検出した内容に基づいていくつかのロジックを実行するステップをトリガーします。残念ながら、問題の属性はターゲットの Attributes コレクションにはありません。(ユーザーが更新するフィールドではありません)。アクティブに更新されていない場合でも、これらの属性を読み取ることができる必要があります。これが私のコードです:
Dim context As IPluginExecutionContext = CType(serviceProvider.GetService(GetType(IPluginExecutionContext)), IPluginExecutionContext)
If context.InputParameters.Contains("Target") AndAlso TypeOf context.InputParameters("Target") Is Entity Then
Dim entity As Entity = CType(context.InputParameters("Target"), Entity)
If entity.LogicalName.Equals("contact") Then
Try
Dim attribute1 As Object = entity.Attributes("abc") ' not in Attributes collection
Dim attribute2 As Object = entity.Attributes("def") ' not in Attributes collection
Catch ex as Exception
...
私の質問は、プラグイン内からエンティティの属性を取得する最良の方法は何ですか? OrginizationService を使用して CRM に別のクエリを発行する必要がありますか、またはコンテキストから取得する方法はありますか?
ありがとう!