The following code should update the status of a ServiceAppointment record to closed. Although the code runs with no errors, the status of the record remains as open.
ServiceAppointment oServiceAppointmentZ = (ServiceAppointment)oOrgServiceZ.Retrieve(ServiceAppointment.EntityLogicalName, oServiceActivityGuidZ, new ColumnSet("activityid", "subject"));
oServiceAppointmentZ.StatusCode = new OptionSetValue((int)ServiceAppointmentState.Closed);
UpdateRequest oUpdateSAZ = new UpdateRequest()
{
Target = oServiceAppointmentZ
};
oOrgServiceZ.Execute(oUpdateSAZ);
Examples I can find say to use a setting called Status (i.e. oServiceAppointmentZ.Status) but this does not exist and is probably related to older versions of Dynamics CRM. There is another field called StateCode but it is read-only.
Any suggestions?
[Edit: Ignore the 5. and 10. above - some bug(?) in the post code editor.]
*This post is locked for comments
I have the same question (0)