0
クローズドインシデントに関連するステータスを取得し、そのインシデントを再度開くことができます。私が理解できないのは、以前のステータスを使用する方法です。 事件を再クローズします。私はそれを再開する前に同じステータスで事件を終わらせたい。CRM SDKを使用してインシデントを再オープンし、同じステータスで閉じる
//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);