02-20-2017 07:42 AM
I have written a simple gadget to display Marquee text when making an outbound call. It is working fine except that the gadget does not clear itself after the call ends. I added the handler for the end dialog event but it still does not clear.
What am I doing wrong/missing here?
===========================================
var finesse = finesse || {};
finesse.modules= finesse.modules|| {};
finesse.modules.clsession= (function ($) {
/*
Function called when workflow action event is received
Logging enabled so we can see event data
Especially useful while developing
*/
var clientLogger= finesse.cslogger.ClientLogger,
/**
* 02/19/2017 - ktagdiwa - Handler for the end of Dialog (when call ends)
* Handler for deletions from the Dialogs collection object for this user. This will occur
* when a Dialog is removed from this user's collection (example, end call)
*/
handleEndDialog = function(dialog) {
clientLogger.log("handleEndDialog()");
// decrement the number of dialogs
//numDialogs--;
// clear the popValue
//popValue = null;
// render the html in the gadget
$('#customContent').html(''); //Clear the gadget content
},
handleWorkflowAction= function(action) {
console.log("*************** Inside handleWorkflowAction...");
// Perform all the event processing here
// Access the action event object data passed to the handler
var actname= action.getName();
var acthandle= action.getHandledBy();
var acttype= action.getType();
var actparam= action.getParams();
var gadgetHeight = 100;
// Log event data and dump params block
console.log("***** WF Action: " + actname+ "/" + acthandle+ "/" + acttype);
console.log("***** Action Params: " + JSON.stringify(action.getParams(), null, 4));
clientLogger.log("***** WF Action: " + actname+ "/" + acthandle+ "/" + acttype);
clientLogger.log("***** Action Params: " + JSON.stringify(action.getParams(), null, 4));
// Process action if BROWSER_POP, OTHER, and targeted at window called MarqueeWFActionWin
if (acttype=="BROWSER_POP"&& acthandle== finesse.containerservices.WorkflowActionEvent.HandledBy.OTHER){
console.log("************* Checking Window Name since the acttype and acthandle matched...");
if (actparam.windowName.value== "MarqueeWFActionWin"){
console.log("***** Matched windowName: " + actparam.windowName.value + ". Now setting the IFRAME tag inside the Gadget HTML...");
// Modify gadget HTML content
var wfhtml= '<iframe width="100%" height="100" style="border:0" src="'+ actparam.path.expandedValue
+ '"> </iframe>';
$("#customContent").html(wfhtml);
console.log("********** Adjusting the height of the gadget.");
gadgets.window.adjustHeight(gadgetHeight);
}
}
};
return {
/*
Function finesse.modules.clsession.init() called from HTML when gadget is loaded
Adds the handler to be called on workflow action events
*/
init: function() {
clientLogger.init(gadgets.Hub, "CL-Session-Workflow");
containerServices= finesse.containerservices.ContainerServices.init(); // Boiler plate call
clientLogger.log("Adding Workflow-Action handler...")
containerServices.addHandler(finesse.containerservices.ContainerServices.Topics.WORKFLOW_ACTION_EVENT, handleWorkflowAction);// Add the handler function defined above as the handler for the WORKFLOW_ACTION_EVENT
}
};
}(jQuery));
Solved! Go to Solution.
02-20-2017 09:58 AM
I realized that I was not binding the handler in the init.
Once I did that, I was able to get this to work.
02-20-2017 09:58 AM
I realized that I was not binding the handler in the init.
Once I did that, I was able to get this to work.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: