2
ダイナミクスCRM内で、リードエンティティはステータスとステータス理由の両方を持ちます。 APIを使用すると、すべてのステータス理由を取得できます。私が立ち上がったのは、ユーザーがStatus Reasonを選択したときに、私は後方に向かって作業したいのですが、どのStatusが選択されたStatus Reasonに関連付けられているかを把握することです。ここでリード "ステータス理由"からリード "ステータス"を取得
は、私はステータス理由のすべてを取得する方法である:
//get the list of status reasons
RetrieveAttributeRequest request = new RetrieveAttributeRequest();
request.EntityLogicalName = "lead";
request.LogicalName = "statuscode";
RetrieveAttributeResponse response = RetrieveAttributeResponse)theOrgContext.Execute(request);
StatusAttributeMetadata picklist = (StatusAttributeMetadata)response.AttributeMetadata;
foreach (OptionMetadata option in picklist.OptionSet.Options)
{
retval.ListOfStatuses.Add(option.Value.Value, option.Label.UserLocalizedLabel.Label.ToString());
}
そして私はちょうどLINQを使用していたエンティティ更新するには:
//set the status to the new value
theLead.StatusCode.Value = int.Parse(statusValue);
theLead.StateCode = ???
//mark the object as updated
theContext.UpdateObject(theLead);
//persist the changes back to the CRM system
theContext.SaveChanges();
を私はクエリを実行する方法を見つけ出すことはできませんどのような価値を私が入れなければならないのか把握するCRM ???
いずれかの質問が表示される前に、お客様は特定のステータスのデフォルトのステータス理由だけを追加することができます。したがって、LINQエンティティに付随する列挙型は使用できません。 –