Hi,
for CRM 2013 you can't do a simple update of the statecode and statuscode field.
If you need to close a Case (incident entity) you need to use a CloseIncidentRequest:
var incidentResolution = new IncidentResolution
{
Subject = "Resolved Sample Incident",
IncidentId = new EntityReference("incident", _incidentId)
};
// Close the incident with the resolution.
var closeIncidentRequest = new CloseIncidentRequest
{
IncidentResolution = incidentResolution,
Status = new OptionSetValue((int)incident_statuscode.ProblemSolved)
};
serviceProxy.Execute(closeIncidentRequest);
if you need to close an activity you need to use a SetStateRequest:
var setStateReq = new SetStateRequest
{
EntityMoniker = new EntityReference(entityLogicalName, entityId),
State = new OptionSetValue(1),
Status = new OptionSetValue(100000004)
};
My blog: www.crmanswers.net -
Rockstar 365 Profile