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

Finesse 10.5 user.setState(states.NOT_READY) Fails to change user state.

croder001
Level 1
Level 1

I have a lookup to a phone directory in a gadget and the users want a button to call directly from their finesse client. This way they reduce user error by possibly typing the wrong phone number on the keypad of the phone itself. Since Finesse cannot place a call when the user is in a Ready state, I need to have this button set them to Not Ready and then place the call.

When there are no Not Ready codes associated with the team, this works normally. Once a Not Ready code is associated with the team, user.setState fails to change to a Not Ready status. It will successfully change from Not Ready to Ready, but that only demonstrates that I have the function call formatted correctly. The following code is pulled directly from the SampleGadget_Final.js provided as a sample. I have tried including a reasoncode, as well as using the name of the not ready status ("Not Ready - Visitor").

Can anyone help with this problem?

Thanks in advance!

Chris Roder

/**
* Handler for makeCall when successful.
*/
makeCallSuccess = function(rsp) {
},

/**
* Handler for makeCall when error occurs.
*/
makeCallError = function(rsp) {
},

setUserState : function (state) {
if (state === 'READY') {
user.setState(states.READY);
} else if (state === 'NOT_READY') {
user.setState(states.NOT_READY);
}
},

1 Accepted Solution

Accepted Solutions

r.hall
Level 1
Level 1

Hi Chris,

The issue is that, if there are reason codes configured, then one must be selected.

user.setState(states.NOT_READY, MyNRRCid);

The slightly tricky bit is that you have to set the ID, not the reason 'text' or the 'code'. For pretty much all objects, (users, queues, skills etc) there is an associated ID. The ID generally gets updated when an object gets updated. You have to enumerate the reason codes to get the ID.

This is how I've done it (which I got from this forum!);

    RCSearch = function (RCnameKey, myRCArray) {

      for ( i = 0; i < myRCArray.length; i++) {

        if (myRCArray[i].label === RCnameKey) {

            return myRCArray[i];

        }

      }

    };

Use this in the success handler of a 'get not-ready reason codes' function to check for the reason code ID.

      MyNRRCid = RCSearch ("MyNRRCText", rsp).id;

Hope this helps.

Richard

View solution in original post

1 Reply 1

r.hall
Level 1
Level 1

Hi Chris,

The issue is that, if there are reason codes configured, then one must be selected.

user.setState(states.NOT_READY, MyNRRCid);

The slightly tricky bit is that you have to set the ID, not the reason 'text' or the 'code'. For pretty much all objects, (users, queues, skills etc) there is an associated ID. The ID generally gets updated when an object gets updated. You have to enumerate the reason codes to get the ID.

This is how I've done it (which I got from this forum!);

    RCSearch = function (RCnameKey, myRCArray) {

      for ( i = 0; i < myRCArray.length; i++) {

        if (myRCArray[i].label === RCnameKey) {

            return myRCArray[i];

        }

      }

    };

Use this in the success handler of a 'get not-ready reason codes' function to check for the reason code ID.

      MyNRRCid = RCSearch ("MyNRRCText", rsp).id;

Hope this helps.

Richard