02-26-2016 05:06 AM
Hi, all.
I am learning to work with finesse gadgets using Learning gadget 10.5.1.
I declared an User object as in instruction.
finesse.modules.SampleGadget = (function($) {
var user,
handleUserLoad = function(userevent) {
alert("user load");
render();
},
handleUserChange = function(userevent) {
alert("user change");
render();
},
render = function() {
var currentState = user.getState();
// Examples of getting data from the User object (GET)
$("#userId").text(user.getId());
$("#firstName").text(user.getFirstName());
$("#lastName").text(user.getLastName());
if (user.hasSupervisorRole()) {
$("#userRole").text('Supervisor');
} else {
$("#userRole").text('Agent')
}
$("#extension").text(user.getExtension());
$("#userState").text(currentState);
// Example of setting the user state (PUT)
if (currentState === states.NOT_READY) {
$("#goReady").show();
$("#goNotReady").hide();
} else if (currentState === states.READY) {
$("#goNotReady").show();
$("#goReady").hide();
} else {
$("#goNotReady").hide();
$("#goReady").hide();
}
gadgets.window.adjustHeight();
};
/** @scope finesse.modules.SampleGadget */
return {
/**
* Performs all initialization for this gadget
*/
init: function() {
alert("init");
var prefs = new gadgets.Prefs(),
id = prefs.getString("id");
finesse.clientservices.ClientServices.init(finesse.gadget.Config);
user = new finesse.restservices.User({
id: id,
onLoad: handleUserLoad,
onChange: handleUserChange
});
states = finesse.restservices.User.States;
gadgets.window.adjustHeight();
}
};
} (jQuery));
But there is no onLoad event, when I am logging into finesse desktop as agent.
It alerts only when I am starting to change manually the agent state onLoad event, then onChange event - and this is behaviour of final gadget version too.
If I am trying to acess user object properties in browser debugger - there is an error
Can u please explain me, what am I doing wrong? Or maybe I have the wrong understanding of event model?
With regards, Yuriy.
But I can access User data only when I changing the agent state manually.
Solved! Go to Solution.
02-29-2016 09:20 AM
Hi Yuriy,
Since the UCCE Sandbox lab is using 9.1(1), please use the matching learning sample gadget here: Cisco DevNet: Finesse - Archive (Scroll to Sample Gadgets for 9.1(1)). I believe that this should fix your problem.
I am shooting to make the Finesse 11.0 gadgets available sometime later this week.
Thanx,
Denise
02-26-2016 03:08 PM
Hi,
Which version of Finesse are you using? My suspicion is that you are using Finesse 11.0. The sample gadget hasn't been updated for 11.0 and modifications are needed to make it work. I am working on getting an official version out for Finesse 11.0 and it will be posted soon. So basically, the sample gadget 10.5 isn't going to work on 11.0.
When I added the alerts where you have it in the code, I was able to see "init" and "user load". I don't see any issues with the code you pasted so my conclusion is that you are running Finesse 11.0.
02-29-2016 12:54 AM
I am using the version available in UCCE Sandbox lab. Unfortunately I didn't noticed the numbers(
Can you please orient me, when about new gadgets for Finesse 11.0 will be available?
With regards, Yuriy.
02-29-2016 02:29 AM
Oh, now I checked it. It is 9.1(1) version.
02-29-2016 09:20 AM
Hi Yuriy,
Since the UCCE Sandbox lab is using 9.1(1), please use the matching learning sample gadget here: Cisco DevNet: Finesse - Archive (Scroll to Sample Gadgets for 9.1(1)). I believe that this should fix your problem.
I am shooting to make the Finesse 11.0 gadgets available sometime later this week.
Thanx,
Denise
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