cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
769
Views
5
Helpful
3
Replies

set state to NOT_READY in 3rd party Gadget

I want to be able to set the User State in a 3rd party Gadget.  I have the following code form a sample gadget provided on the cisco site

 

setUserState : function (state) {
clientLogs.log("setUserState(): The user's current state is: " + state);
if (state === 'READY') {
alert('Before Set ready');
user.setState(states.READY);
alert('After Set ready');
} else if (state === 'NOT_READY') {
alert('Before Set not_ready');
user.setState(states.NOT_READY);
alert('after Set not_ready');
}
},

 

User.setstate(state.Ready)  works fine but

User.SetState(state.NOT_READY) fails with a 400 (bad Request)

 

 

1 Accepted Solution

Accepted Solutions

dekwan
Cisco Employee
Cisco Employee

Hi,

 

Did you look at the response body of the 400? Is it something like this?

<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>
 
My gut feel is that you have not ready reason codes configured and you are trying to change the user to not ready without providing it a reason code. 
 
{finesse.restservices.User} setState(newState, reasonCode, handlers)
Set the state of the user.
Parameters:
{String} newState
The state you are setting
{ReasonCode} reasonCode
The reason this user is logging out. Pass null for no reason.
{finesse.interfaces.RequestHandlers} handlers
An object containing the handlers for the request
Returns:
{finesse.restservices.User} This User object, to allow cascading

You need to use the setState that takes in a ReasonCode object.

 

I am also making the assumption that the capital U for your User.setState is a typo.

 

Thanx,

Denise

View solution in original post

3 Replies 3

Sean Lynch
Level 7
Level 7
 

dekwan
Cisco Employee
Cisco Employee

Hi,

 

Did you look at the response body of the 400? Is it something like this?

<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>
 
My gut feel is that you have not ready reason codes configured and you are trying to change the user to not ready without providing it a reason code. 
 
{finesse.restservices.User} setState(newState, reasonCode, handlers)
Set the state of the user.
Parameters:
{String} newState
The state you are setting
{ReasonCode} reasonCode
The reason this user is logging out. Pass null for no reason.
{finesse.interfaces.RequestHandlers} handlers
An object containing the handlers for the request
Returns:
{finesse.restservices.User} This User object, to allow cascading

You need to use the setState that takes in a ReasonCode object.

 

I am also making the assumption that the capital U for your User.setState is a typo.

 

Thanx,

Denise

Thanks to all for the assistance.