none
修改Incident(案例)的状态为已解决,代码怎么写 RRS feed

  • 问题

  • SetStateIncidentRequest request = new SetStateIncidentRequest();
    request.EntityId = id;
    request.IncidentResolutionState = IncidentState.Resolved;
    request.IncidentResolutionStatus = 5;
    service.Execute(request);
    我这样做会报错。。。正确的写法是怎么样的
    2010年6月11日 1:21

答案

  • incidentresolution res = new incidentresolution();
    res.incidentid = new Lookup();
    res.incidentid.type = EntityName.incident.ToString();
    res.incidentid.Value = new Guid("0b94e8e2-1596-de11-b7cc-000c296bb2ca");
    res.description = "resolved";
    res.statecode = new IncidentResolutionStateInfo();
    res.statecode.Value = IncidentResolutionState.Completed;
    res.timespent = new CrmNumber();
    res.timespent.Value = 4;

    CloseIncidentRequest req = new CloseIncidentRequest();
    req.IncidentResolution = res;
    req.Status = 5;

    CloseIncidentResponse closeresp = (CloseIncidentResponse)service.Execute(req);
    • 已标记为答案 mainclass 2010年6月12日 5:50
    2010年6月11日 15:49