cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1935
Views
0
Helpful
7
Replies

Gadget not triggering button action

martyn.rees
Level 4
Level 4

I've got a gadget that I've built that will trigger a call to a set number when the button is clicked by an agent. I'm having issues though with the button push not then triggering any action from the event.The gadget is rendered in the agent window, but the button push doesn't then trigger the call.

Is there something that I've missed in the XML logic?

<?xml version="1.0" encoding="UTF-8"?>

<Module>

    <ModulePrefs title="Play Legal Prompts" >

        <Require feature="settitle" />

        <Require feature="dynamic-height" />

        <Require feature="pubsub-2" />

        <Require feature="setprefs" />

<Require feature="loadingindicator">

            <Param name="manual-dismiss">false</Param>

            <Param name="loading-timeout">10</Param>

</Require>

    </ModulePrefs>

    <Content type="html">

<![CDATA[

<!DOCTYPE html>

<!-- Styling -->

<link rel="stylesheet" href="prompts.css" type="text/css" />

<!-- jQuery -->

<script type="text/javascript" src="/desktop/assets/js/jquery.min.js"></script>

 

<!-- Finesse Library -->

<script type="text/javascript" src="/desktop/assets/js/finesse.js"></script>

<!-- Gadget Business Logic -->

<script type="text/javascript" src="prompts.js"></script>

<body class="claro">

<div id="call">

                            <button onClick="finesse.modules.prompts.makeCall('9000');">Call 9000</button>

                        </div>

</body>

<script type="text/javascript">

            gadgets.HubSettings.onConnect = function () {

                finesse.modules.prompts.init();

                 };

            </script>

]]>

    </Content>

</Module>

7 Replies 7

dekwan
Cisco Employee
Cisco Employee

Hi,

I don't see anything wrong with the XML. Did you make sure that the namespace of your prompts.js is correct? Is the makeCall method in the return section?

I suggest using the browser's developer tools and breakpoint the makeCall method and see if it is getting in there. Also, take a look at the console of the developer tools to see if there is an error in your js file. Did you use the LearningSampleGadget as the base? If not, take a look at those files.

Thanx,

Denise

Hi Denise,

Yes, I have used the samplegadget as the base for this, and I think I've got the namespace correct.

finesse.modules.prompts = (function ($) {

The return section does contain the makeCall function.

return {

/**

         * Make a call to the number from the XML

         */

        makeCall : function (number) {

            clientLogs.log("makeCall(): Making a call to " + number);

Dialog.makeConsultCall(fromAddress, number, {

                success: makeCallSuccess,

                error: makeCallError

            });

        },

        /**

         * Performs all initialization for this gadget

         */

        init : function () {

            var cfg = finesse.gadget.Config;

            clientLogs = finesse.cslogger.ClientLogger;  // declare clientLogs

            gadgets.window.adjustHeight();

            // Initiate the ClientServices and load the user object. ClientServices are

            // initialized with a reference to the current configuration.

            finesse.clientservices.ClientServices.init(cfg, false);

            // Initiate the ClientLogs. The gadget id will be logged as a part of the message

            clientLogs.init(gadgets.Hub, "prompts", finesse.gadget.Config);

            user = new finesse.restservices.User({

                id: cfg.id,

                onLoad : handleUserLoad,

                onChange : handleUserChange

            });

            states = finesse.restservices.User.States;

           

            // Initiate the ContainerServices and add a handler for when the tab is visible

            // to adjust the height of this gadget in case the tab was not visible

            // when the html was rendered (adjustHeight only works when tab is visible)

            containerServices = finesse.containerservices.ContainerServices.init();

            containerServices.addHandler(finesse.containerservices.ContainerServices.Topics.ACTIVE_TAB, function() {

                clientLogs.log("Gadget is now visible");  // log to Finesse logger

                // automatically adjust the height of the gadget to show the html

                gadgets.window.adjustHeight();

            });

            containerServices.makeActiveTabReq();

        }

    };

}(jQuery));

Looks right based on what you pasted. Is the init being triggered? Do you see any "prompts" logs? Like i mentioned in my last reply, you will probably need to breakpoint the code in the developer tools and see what is going on.

Thanx,

Denise

Thanks Denise.

Running the developer tools it seems that it is having an issue with Finesse not being defined, even though it is...

ReferenceError: finesse is not defined

onclick

From the js file though I can see that it is defined.

var finesse = finesse || {};

finesse.gadget = finesse.gadget || {};

finesse.container = finesse.container || {};

clientLogger = finesse.cslogger.ClientLogger || {};

finesse.modules = finesse.modules || {};

finesse.modules.prompts = (function ($) {

    var user, states, dialogs, clientlogs,

Hi,

What version of Finesse are you using? Is it 11.0 or above? That error typically means that the prompt.js is not being loaded correctly. Is there any syntax issues with it? Is the init function being executed?

Thanx,

Denise

I'm testing against 11.6

I'll have to figure out how to debug the prompts.js and see if the init function is being executed.

I like to use Chrome's developer tools for breakpointing.

For the Chrome developer tools:

1. Go to the Sources tab

2. You will see finesse_gadget_0, finesse_gadget_1, etc.

3. Hover over each one until it highlights your gadget

4. Open up the tree for that finesse_gadget_*.

5. There will be some folders and items such as ifr?*, concat?*, proxy?*.

6. Click on the concat?*. That should be your prompts.js file.

7. Scroll all the way down and put a breakpoint in the init method.

Hope that helps.

Thanx,

Denise

Getting Started

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: