How do you set the Reason Code using the JavaScript API?
To set the reason code, you must use the setState() JavaScript API. Here is a code example:
var currentState = user.getState();
if (currentState == "READY") {
var rc = { id: '5' };
user.setState(states.NOT_READY, rc, {
success: success,
error: makeStateError
});
}
Note that the id of 5 is the system generated id for the reason code, not the reason code itself.
So for the above code, if you do a REST request to get the list of NOT_READY reason codes,
http://<FQDN>/finesse/api/User/<id>/ReasonCodes?category=NOT_READY
The response will be:
<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>
</ReasonCodes>
Notice that the value of id is 5 and not 10.
Comments
0 comments
Please sign in to leave a comment.