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.
04-05-2019 06:16 AM
Understanding the Underlying REST API used to do this (showing this is possible)
https://developer.cisco.com/docs/finesse/#!dialogupdate-call-variable-data/dialogupdate-call-variable-data
JavaScript Library
https://developer.cisco.com/docs/finesse/#!javascript-library
finesse.restservices.Dialog.Actions
UPDATE_CALL_DATA - Updates data on a Call Dialo
Regards,
Gerry
04-05-2019 05:41 AM
Hi Gerry,
Can you please provide a sample code. as far as i understand is we can pass only one variable and its value as per below code.
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;
};
04-05-2019 10:47 AM
Hi,
As Gerry pointed out, you need to understand the REST API to make the modifications to the gadget code. Per the REST API documentation you can put the following:
<Dialog> <requestedAction>UPDATE_CALL_DATA</requestedAction> <mediaProperties> <callvariables> <CallVariable> <name>callVariable1</name> <value>123456789</value> </CallVariable> <CallVariable> ... Other call variables to be modified ... </CallVariable> </callvariables> </mediaProperties> </Dialog>
As you can see from the above, you just need to put multiple <CallVariable> tags within the <callVariables>.
In the code you pasted, you have:
var mediaProperties = { "callvariables": callvariable };
So what you need to do is something like this:
var callvar2 = { "name" : name, "value" : value }; var callvariable2 = { "CallVariable" : callvar2 }; var mediaProperties = { "callvariables": { callvariable, callvariable2 };
I am just writing the above from memory, so my syntax might not be completely right, but hopefully you get the point.
Thanx,
Denise
04-12-2019 02:54 AM
Hi Denise,
I am able to update now. Thanks for reply.
Can we add response event handler to this code if yes can you please suggest?
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;
};
04-22-2019 10:05 AM
Hi,
Yes, in your options, you can have options.success and options.error which both would take a handler.
Thanx,
Denise
05-25-2017 03:10 AM
HI dlender,
I have an ECC variable name user.MembID and I am trying to set its value using the script you have posted. I am not getting any error and I am not getting variable updated value in call grid. however it is working for regular call variable updation. please suggest where i am missing any things?
Thanks
Navin Saxen
05-25-2017 05:53 AM
05-25-2017 05:58 AM
What??? havent seen any link or attachement
-- Navin
05-25-2017 06:36 AM
I don't know why you can't see it but I attached it to that post.
05-25-2017 06:45 AM
I can see two attachments and both of them were 2 year old. i cant find any recent attachment and I am using the same script
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;
};
05-25-2017 06:51 AM
05-25-2017 07:00 AM
HI Alexis,
Thanks for the attachment. Just checked the code and find that this is the same code i am using.
it is just working fine for CallVariable1 etc.. but it is not updating the ECC like user.MembID in my case.
-Navin
05-25-2017 09:58 PM
Hi Navin,
What do you see in the client & webservices logs when you make the call variable update request? What is the error you get?
Also, are you sure you have the right call variable name? You should look at the dialog notification you get when the call arrives.
Thanx,
Denise
05-08-2014 11:02 AM
David
My customer is going to upgrade to UCCE V10 and replace CTIOS with Finesse.
The showstopper is ability to write to Var fields.
Could please help me with
1 How to apply provided SetCallVariable gadget to Finesse
2 Do you know if/when Set Variable gadget will be available for inbound calls
Thanks
05-08-2014 11:42 AM
The ability to write to callvariables exists now in Finesse 10.0, it just requires a custom gadget. I am not sure I understand what is a showstopper, unless it is the ability to write callvars using the out of box CallControl gadget that comes with Finesse.
I am also not sure what help you are needing. Have you tried to use the SetCallVariable sample gadget attached to this thread?
If you are unfamiliar with custom gadgets, see the Getting Started page
The SetCallVariable sample shows how to set callvariables on the currently active call, so it handles inbound calls.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide