cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

11890
Views
9
Helpful
60
Replies
Gerry O'Rourke
Rising star

Setting a Call Variable using JavaScript

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.

1 ACCEPTED SOLUTION

Accepted Solutions
dlender
Frequent Contributor

Currently you have to override the finesse.js Javascript library Dialog to add an updateCallVariable method like this:

finesse.restservices.Dialog.prototype.updateCallVariable =  function (name, value, options)

    {

        this.isLoaded();

                                var callvar = {

                                                  "name" : name,

                                                  "value" : value

                                };

                                var callvariable = { "CallVariable" : callvar };

        var mediaProperties =

        {

            "callvariables":  callvariable

        };

        options = options || {};

        options.content = {};

        options.content[this.getRestType()] =

        {

            "mediaProperties": mediaProperties,

          // "requestedAction": finesse.restservices.Dialog.Actions.UPDATE_CALL_DATA

                                  "requestedAction": "UPDATE_CALL_DATA"

        };

        options.method = "PUT";

        this.restRequest(this.getRestUrl(), options);

        return this;

    };

In your xml you would have a textbox with a Set CV1 button:

<button onClick="finesse.modules.SampleGadget.updateCallVariable('callVariable1', ($('#callvar1')).val());">Update CV1</button>

updateCallVariable : function ( name, value){

                                clientLogs.log("updating Call Variable " + name + " " + value);

                                clientLogs.log("dialog id: " + currdialog.getId());

                                var options = {};

                                currdialog.updateCallVariable(name, value, options);

                                },

In a future release, the updateCallVariable will be a part of finesse.js

There will also be a SetCallVaribiable sample gadget posted in the near future.

View solution in original post

60 REPLIES 60