cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
383
Views
0
Helpful
1
Replies

User.SetState fails - Error = <ErrorData>finesse.api.reasoncode.require_reasoncode</ErrorData> <ErrorMessage>The state change requires a valid reason code.</ErrorMessage>

kelvinevans48371
Beginner
Beginner

getting the following error message when calling SetState

 

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>',

 

The code is as follows

setUserState: function (state) {
clientLogs.log("setUserState(): The users current state is: " + state);

if (state == 'NOT_READY') {
alert("setUserState(): Changing the user state to: " + state);

user.setState(
states.NOT_READY,
2, {
success: makeCallSuccess,
error: makeCallError
});

}
else if (state == 'READY')
{
alert("setUserState(): Changing the user state to: " + state);
user.setState(
states.READY, {
success: makeCallSuccess,
error: makeCallError
});
}
},

 

Help please

1 Reply 1

dekwan
Cisco Employee
Cisco Employee

getHi,

 

The format of the JavaScript method to set the state with a reason code is: 

 

Untitled.png

So, you need to pass it a ReasonCode object, which is just the format of:

 

{
    id: _reasonCodeId
}

Also, remember to use the reason code Id and not the reason code number. To get the reason code Id, you can use the getNotReadyReasonCodes method (https://pubhub.devnetcloud.com/media/finesse/docs/guides/javascript-library/symbols/finesse.restservices.User.html#getNotReadyReasonCodes). If you just want the number for testing sake, you can use the API: https://developer.cisco.com/docs/finesse/#!userget-reason-code-list

 

Thanx,

Denise

 

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Recognize Your Peers