I'm trying to close out a ServiceAppointment in code. I can change the StatusCode but not the StateCode. I'm getting an error saying StatusCode100000010is not a valid code for an open ServiceAppointment. At the top of the code below are the two different ways that I've tried to set the StateCode. Neither one works.
I've seen the SetStateRequest code for the SDK but I am not using the SDK. I have a Service Reference inside Silverlight pointing to my OrganizationData.svcretrievedSA.StateCode.Value = 1; retrievedSA.StatusCode.Value = 100000010; // OR retrievedSA.StateCode = new OptionSetValue() { Value = 1 }; retrievedSA.StatusCode = new OptionSetValue() { Value = 100000010 }; myContext.UpdateObject(retrievedSA);
myContext.BeginSaveChanges(OnRescheduledServiceAppointmentCompleted, retrievedSA);
How can I go about changing the StateCode to closed for this?