cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
17319
Views
9
Helpful
60
Replies

Setting a Call Variable using JavaScript

Gerry O'Rourke
Spotlight
Spotlight

Hi,

I can see how to retrieve the ICM call variables using Finesse JavaScript Library e.g.

dialog.getMediaProperties();

But is it possible to set/update the call variables using the Finesse JavaScript Library?

If so, does anyone have a simple example?

Gerry.

60 Replies 60

David

I loaded setcallvariable.zip but it doesn’t have read me portion.

If you have one please send.

I try to make it work at the lab and let you know

Thanks  a lot

Attaching a version with the readme and pdf

Thanks David. In theory it should be possible to use the attached script to set the "user.microapp.isPostCallSurvey" expanded call variable to "y". By doing that the agent can determine whether to send a specific caller to a post call survey script or not.

Is this statement correct? Just want to consult before I start building the script.

Thanks again!

Yes, you can use the currdialog.updateCallVariable to update an ecc variable.  Any parties to the Dialog will see that call variable and know to send the Dialog to another destination (which could be an IVR).

Would you happen to have this for 10.6?  It seems this one wont update the variables...

In his example he uses something to the effect of finesse-10.0.js (I forget the exact file name). If you get the 10.6 version, bundle it with your gadget, and then edit the xml to reflect that it will work. At least it did for 10.5. At which point you can play around with it a bit before you write up your own.

EDIT : and if you have an answer for my post How do I fetch a custom ECC within a 3rd party gadget? That would be awesome!

Just confirming that this also works with the 10.5.1 Javascript API/SDK as well.  Your sample code included that Bing Maps iframe, BTW. 

Peter Straatman
Level 1
Level 1

Hello

I have installed the finesse sample gadget SetCallVariableSampleGadget-10.0.1

and am using Finesse 10.5(1)

Changing the value in call variable 1 does not have any effect.

I went thru all the code and had a look at the clientlogs.It seems the finesseext.js does not update the call variable 1, although the parameters passed are ok. I also checked the t_Termination_Call_Detail records and they do not contain the new value for the call variable 1, which seems logical if the finesseext.js "fails". I am not a gadget code expert, so any help/idea appreciated.

.

You can't use Sample Versions that don't match the version of Finesse you are using. Why would you even try?

this does not really help.

as far as I know there is no sample script for Finesse 10.5(1) so it seems most logical to start with the 10.0.1 version.

If you know of a 10.5(1) version of SetCallVariableSampleGadget-10.0.1 pls let know.

I can not imagine it would be completely different. If that would be the case how could you ever upgrade to another version of Finesse when you are using (a lot of) gadgets ?

Peter,

There are sample scripts for FInesse 10.5 see below link

Finesse sample gadgets

Although your code should not have to change when you run on a different version of Finesse, the Finesse JavaScript file MUST match the FInesse version you are using.

So you need to download to obtain the correct Javascript API file i.e. finesse-10.5.1.js

Test with the updated file and see how you get on?

Regards,

Gerry

Where did you get the SetCallVariableSampleGadget-10.0.1??? I don’t see it anywhere in the sample gadget sources…not even 10.0.

The finesse.js for each release is backwards compatible with each release but must match the version of Finesse you are deploying to. This is why the current set of Samples distributed on DevNet are versioned the way they are.

In 10.6.1 we have made a change to provide the finesse.js from within the Finesse Server itself so that it can be loaded relative to the Gadget. This would mean that any Gadgets being developed >=10.6.1 could load it this way without needing to package the finesse.js.

Unfortunately the DevNet Site is only up to date as of 10.5.1. We are in the process of getting these new Gadgets on there, but that will probably align with our 11.0 release coming out not to long from now.

In the meantime though, if you are using 10.5.1 you have to use the finesse-10.5.1.js. I recommend downloading it from a different Gadget and swapping it out.

g.

I got it some time ago from Setting a Call Variable using JavaScript

It works when using finesse-10.5.1.js

thx !

The ultimate goal is to set a call variable automatically when a call arrives at the agent. So e.g. set callVariable1 to the agent extension (or any other variable) without any interaction being required by the agent.(e.g. a button click) and without any visible features. Stripped out most of the code in the gadget but it is not as easy as it seems. The finesseext.js gets the proper name/value pair but the t_Termination_Call_Detail records do not contain the value. Not sure if this is even possible?

rbroersm
Level 1
Level 1

Hello,

So, I'm using the code described in this post in a 10.5 environment.  We deployed the gadget and are seeing an ~20% failure rate on the dialog.restRequest API call.  It is completely random.  The UI basically allows agents, when in wrap-up, to choose from a list of 'disposition codes' and then submit.  On submit, the selected code should be written to PV6.

I'm hoping someone else has run into this and can help explain this behavior.  We have a TAC case open as well, but wanted to also check w/ the community.

Latest variation of code....

updatePV =  function (name, value, options) {

  var APIstatus = "Good";

  var callvar = {"name" : name, "value" : value};
  var callvariable = {"CallVariable" : callvar};
        var mediaProperties = {"callvariables":  callvariable};

        options = options || {};
        options.content = {};
  //alert("before the updatePV");
        options.content["Dialog"] =
        {
           "mediaProperties": mediaProperties,
     "requestedAction": "UPDATE_CALL_DATA"
        };
 
        options.method = "PUT";
 
  options.success = function(){
   //alert("disposition successful");
   APIstatus="Good";
  };
 
  options.error = function(){
   alert("disposition error");
   APIstatus="Bad";
  };
 
        currdialog.restRequest(currdialog.getRestUrl(), options);
 
  return currdialog;
    };


functionUpdatePV : function ( name, value){
  //clientLogs.log("********updating Call Variable " + name + " " + value);
  //alert("*********dialog id: " + currdialog.getId() + " NAME: " + name + " VALUE: " + value + " ParticipantState: " + myParticipant.state);
  //var value2 = value.substring(0,3);
  $("#dispositionResult").text("Disposition Submitted");
  var options = {};
  setTimeout(updatePV(name, value, options), 1000);
  setTimeout(this.setUserState, 1500);
  //this.setUserState();
},

Any help would be appreciated.

Thanks,

Ryan.

On lines 40 & 41 you are starting 2 timers that are essentially 500 ms apart. So it looks like you're starting the submit and 500ms later trying to set the agent state. 500ms might not be enough time for the REST request to finish submitting and allow Finesse to complete it's work. You might want to try setting the user state in the options.success and options.error callbacks instead, that way the update request will have time to finish before the state change is requested.