locked
setstaterequest not working for incident RRS feed

  • Question

  • Hello, I'm trying to re-activate an incident so I can update a field value.  I'm using the following code:

                SetStateRequest req = new SetStateRequest();
                req.EntityMoniker = new EntityReference(incident.LogicalName, incident.Id);
                req.State = new OptionSetValue(0);
                req.Status = new OptionSetValue(-1); //5 is not a valid status code for state code IncidentState.Active on incident
                //req.Status = new OptionSetValue(0); //0 is not a valid status code on incident.
                //req.Status = new OptionSetValue(1); //5 is not a valid status code for state code IncidentState.Active on incident.
                //req.Status = new OptionSetValue(2); //5 is not a valid status code for state code IncidentState.Active on incident.
                //req.Status = new OptionSetValue(3); //5 is not a valid status code for state code IncidentState.Active on incident.
                orgService.Execute(req);

    As you can see from my inline comments above, I'm having problems setting the Status value.  For practical purposes, it doesn't matter what I set the value to because my code is going to revert the status back to Active after the update.  Any idea what the issue might be?

    Friday, January 3, 2014 9:07 PM

All replies

  • Hi,

    Incident (Case) and other special entities has their own Request message to close (or change it's status). Check the SDK for CloseIncidentRequest.

    Hope it helps.

    Saturday, January 4, 2014 5:47 AM
  • Hi,

    Please re-check following link and use appropriate values for status and state code. 

    http://msdn.microsoft.com/en-us/library/gg509043.aspx


    Hope this helps. If you get answer of your question, please mark the response as an answer and vote as helpful !!!
    Vikram Singh. !!!  My Blog

    Saturday, January 4, 2014 5:59 AM