AnsweredAssumed Answered

Unable to set reason code to NOT_READY

Question asked by patrickcurley on Feb 19, 2015
Latest reply on Mar 6, 2015 by

I have a gadget where I need to set the agent to NOT_READY.


Here is a code snippet:

var currentState = user.getState();

     if ( currentState == "READY" ) {

          console.log("Setting state to NOT_READY");


               success: success,

               error: makeStateError






I always get the same error:

Object { status: 400, content: "<ApiErrors>


    <ErrorType>Parameter Missing</ErrorType>


    <ErrorMessage>The state change requires a valid reason code.</ErrorMessage>


</ApiErrors>", object: Object }



I know I need to send the reason code id.  But it still gives me this error. 

I used this to get the valid reason code ids.


Here is part of the return:

<ReasonCodes category="NOT_READY"><ReasonCode><uri>/finesse/api/ReasonCode/5</uri><category>NOT_READY</category><code>10</code><label>End of Shift</label><forAll>true</forAll></ReasonCode>


As you can see I get a reason code id of 10 back.  So I use 10 for the reason code id when I try to change the agent state but I always get the error.  Any help would be appreciated.