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 finnur@sensa.is

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");

          user.setState(states.NOT_READY,'10',{

               success: success,

               error: makeStateError

          });

     }

};

 

 

I always get the same error:

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

  <ApiError>

    <ErrorType>Parameter Missing</ErrorType>

    <ErrorData>finesse.api.reasoncode.require_reasoncode</ErrorData>

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

  </ApiError>

</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.

http://10.89.194.14/finesse/api/User/50005/ReasonCodes?category=NOT_READY

 

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.

Outcomes