【发布时间】:2016-12-13 18:18:02
【问题描述】:
我可以检索与已关闭事件相关的状态并重新打开该事件。我无法理解的是如何使用以前的状态时 我重新关闭事件。我想以重新打开之前使用的相同状态关闭事件。
//get the incident
incident = _service.Retrieve(incident.LogicalName, _incidentId, attributes);
//get the status code
Int32 tmp_status = Convert.ToInt32(incident["statuscode"]); //DOES NOT WORK
//open incident
SetStateRequest state = new SetStateRequest();
state.EntityMoniker = new EntityReference("incident", _incidentId);
state.State = new OptionSetValue(0);
state.Status = new OptionSetValue(4);
SetStateResponse stateSet = (SetStateResponse)_serviceProxy.Execute(state);
//close incident
var incidentResolution = new IncidentResolution
{
Subject = "Incident Resolved",
IncidentId = new EntityReference(Incident.EntityLogicalName, _incidentId)
};
var closeIncidentRequest = new CloseIncidentRequest
{
IncidentResolution = incidentResolution,
Status = new OptionSetValue(tmp_status) //Can't get the syntax of how to use tmp_status
};
_serviceProxy.Execute(closeIncidentRequest);
【问题讨论】:
标签: c# sdk dynamics-crm crm