Dynamics Crm online 2016 set opportunity statecode
Dynamics Crm online 2016 set opportunity statecode
我正在寻找将机会的状态代码设置为 "not active" 或 "closed" 所需的 C#(控制台应用程序)语法。事实上,我还想知道在哪里可以找到 statecode 的可用值,因为在字段属性中我看到数据类型是 "Status",但我没有看到可用值。
提前致谢
机会的有效状态代码:
statecode - statuscode
0 (Open) - 1 (In Progress), 2 (On Hold)
1 (Won) - 3 (Won)
2 (Lost) - 4 (Cancelled), 5 (Out-Sold)
因为您想“关闭”机会,请使用LoseOpportunityRequest SDK 消息"Cancel"机会。
您需要使用 LoseOpportunityRequest
来更改状态。还有一个WonOpportunityRequest
。作为更改为 closed-lost 状态的一部分,您需要创建一个 opportunityclose
实体,这是 LoseOpportunityRequest
处理的一部分。
LoseOpportunityRequest req = new LoseOpportunityRequest();
Entity opportunityClose = new Entity("opportunityclose");
opportunityClose.Attributes.Add("opportunityid", new EntityReference("opportunity", new Guid("D711C1BD-23DA-E011-94B4-1CC1DEF177C2")));
opportunityClose.Attributes.Add("subject", "Lost the Opportunity!");
req.OpportunityClose = opportunityClose;
// 4 = Cancelled and 5 = Out-Sold
req.Status = new OptionSetValue(4);
LoseOpportunityResponse resp = (LoseOpportunityResponse)_orgService.Execute(req);
我正在寻找将机会的状态代码设置为 "not active" 或 "closed" 所需的 C#(控制台应用程序)语法。事实上,我还想知道在哪里可以找到 statecode 的可用值,因为在字段属性中我看到数据类型是 "Status",但我没有看到可用值。
提前致谢
机会的有效状态代码:
statecode - statuscode
0 (Open) - 1 (In Progress), 2 (On Hold)
1 (Won) - 3 (Won)
2 (Lost) - 4 (Cancelled), 5 (Out-Sold)
因为您想“关闭”机会,请使用LoseOpportunityRequest SDK 消息"Cancel"机会。
您需要使用 LoseOpportunityRequest
来更改状态。还有一个WonOpportunityRequest
。作为更改为 closed-lost 状态的一部分,您需要创建一个 opportunityclose
实体,这是 LoseOpportunityRequest
处理的一部分。
LoseOpportunityRequest req = new LoseOpportunityRequest();
Entity opportunityClose = new Entity("opportunityclose");
opportunityClose.Attributes.Add("opportunityid", new EntityReference("opportunity", new Guid("D711C1BD-23DA-E011-94B4-1CC1DEF177C2")));
opportunityClose.Attributes.Add("subject", "Lost the Opportunity!");
req.OpportunityClose = opportunityClose;
// 4 = Cancelled and 5 = Out-Sold
req.Status = new OptionSetValue(4);
LoseOpportunityResponse resp = (LoseOpportunityResponse)_orgService.Execute(req);