- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2014 11:47 AM
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.
Solved! Go to Solution.
- Labels:
-
Finesse
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2014 07:56 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2014 07:56 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-11-2014 08:49 AM
Thanks for the response David.
Gerard.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2014 05:44 AM
David,
> There will also be a SetCallVaribiable sample gadget posted in the near future.
Any idea on when this near future will be? weeks / months etc.?
Also it would be good if the Click to Dial Sample Gadget was enhanced (I will post on a dedicated discussion).
Ideally it should change to a Transfer (and allow consult or blind) when agent state changes to talking.
Transfer allows Call Variables to be passed to other agent, while a new call does not.
Gerard.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2014 06:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2014 07:28 AM
Brilliant. thanks David.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2015 06:22 PM
David - why doesn't UCCX allow call variables to be passed in via the MAKE_CALL action? I am really struggling to pass call variable data into UCCX from a CRM that is trying to use the Finesse APIs. I can't pass the variables via MAKE_CALL and I also can't even update the dialog using UPDATE_CALL_DATA when I authenticate to the Finesse API as an admin user.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2015 10:20 AM
Being able to set call variables when an agent makes a call and receives a call directly would be great! Has anyone been able to do this? As the SetVariable calls wont update variables that are null.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2015 07:50 AM
If you are talking about an ECC call variables, then you could try this...
var callVars = dialog.getMediaProperties();
Then, you can access ECC variables like this:
somevariable = callVars["user.ecc_variable_name"];

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2015 10:50 AM
That works great if you want to GET the variable. The question was how to UPDATE the variable so your answer is irrelevant.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2015 09:11 AM
Here is an example of updating a call variable.
var options = {};
currdialog.updateCallVariable(name, value, options);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2015 08:18 AM
That only works if you extend the Finesse.js file as documented in the original post. If you do not want to change the Finesse file you can also do it this way:
var callvar = {
"name" : "CallVarialbe1",
"value" : "Variable Value"
};
var callvariable = { "CallVariable" : callvar };
var mediaProperties = { "callvariables": callvariable };
var options = options || {};
options.content = {};
options.content["Dialog"] =
{
"mediaProperties": mediaProperties,
"requestedAction": "UPDATE_CALL_DATA"
};
options.method = "PUT";
options.success = function() {
_clientLogger.log("Call Vars updated successfully");
};
options.error = function() {
console.error("Failed to update call variable");
};
// Update the variables
currDialog.restRequest(currDialog.getRestUrl(), options);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 03:09 AM - edited 04-05-2019 03:10 AM
Can we set multiple call variables in a single call?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 04:43 AM
Yes. You can.
Gerry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2019 05:17 AM
Can you please provide a sample?
