title: CRM 2013 to update statecode of Incident Resolution Entity
body: <p>I am quite new to this part of CRM. I want to set the StateCode field of Incident Resolution Entity.</p>
  
  <p>I am trying the following way - </p>
  
  <pre><code>IncidentResolution res = new IncidentResolution();
  res.IncidentId = new EntityReference();
  res.IncidentId.LogicalName =Incident.EntityLogicalName;
  res.IncidentId.Id = new Guid(row["id"].ToString());
  res.StateCode = new OptionSetValue((int)IncidentResolutionState.Completed)); //This Following gives the error as System.Nullable&lt;IncidentResolution.StateCode&gt; cannot be assigned to--It is readonly.
  CloseIncidentRequest req = new CloseIncidentRequest();
  req.IncidentResolution = res;
  req.Status = new OptionSetValue();
  req.Status.Value = 5; // Problem Solved
  service.execute(req);
  </code></pre>
  
  <p>The problem i am facing is to set the StateCode property for Incident Resolution Entity.
  Any help would be appreciated.
  Thanks in Advance</p>