Answered SetStatecode error

  • Monday, April 07, 2008 11:54 AM
     
     
    hey
    i am tryin to set the statecode of a serviceappointment after i've made it, but it wont do it as explained below =>

    Close activity function :

    using (sbs.CrmService cs = new Easy.sbs.CrmService())
    {
    try
    {
    cs.Credentials = new System.Net.NetworkCredential("******", "**********");

    sbs.SetStateAppointmentRequest setreq = new Easy.sbs.SetStateAppointmentRequest();
    setreq.EntityId = lastGuid;
    setreq.AppointmentState = Easy.sbs.AppointmentState.Completed;
    setreq.AppointmentStatus = -1;
    sbs.SetStateAppointmentResponse setres = (sbs.SetStateAppointmentResponse)cs.Execute(setreq);
    }
    catch (System.Web.Services.Protocols.SoapException ex)
    {
    MessageBox.Show(ex.Detail.InnerXml, "error");
    }
    }


    using setreq.AppointmentStatus = -1; ... i get this innerxml error :
    -<decription>The specified object was not found.</decription>
    although i am sure its not a invalid GUID because i can delete that same object using the GUID...

    using setreq.AppointmentStatus = 2;... i get this innerxml error:
    <decription>State code is invalid or state code is valid but status code is invalid for a specified state code.</description>

    but i am not sure if thats the line causing the error (but i think it is) so i posted the function...

All Replies

  • Wednesday, April 09, 2008 7:53 AM
     
     Answered
    found the issue...
    there's nothin wrong with the code, its just that i had to use SetStateServiceAppointmentRequest and response.