AnsweredAssumed Answered

Finesse Gadgets parsing user ID in xml

Question asked by bruce.finney@wwt.com on Sep 7, 2016
Latest reply on Sep 7, 2016 by dekwan

So I'm trying to replicate the agent call logs from CAD.  I'm using the SampleGadget as a starting point.  I just want to be able to check (with an if statement) the user ID and show THAT agent's CDR for the day via CUIC.  I'm wanting to do this in the javascript section of the XML page (what I've changed is in red):

     <body class="claro">
                <!-- Sample Gadget -->
                <div>
                    <fieldset id="userfieldset" class="outline">
                        <legend>User</legend>
                        <div><b> User ID: </b><span id="userId"></span></div>
                        <div><b> First Name: </b><span id="firstName"></div>
                        <div><b> Last Name: </b><span id="lastName"></div>
                        <div><b> Role: </b><span id="userRole"></div>
                        <div><b> Extension: </b><span id="extension"></div>
                        <div><b> Current User State: </b><span id="userState"></div>
                        <br>
                        <div id="goReady">
                            <button onClick="finesse.modules.SampleGadget.setUserState('READY');">Change state to READY</button>
                        </div>
                        <div id="goNotReady">
                            <button onClick="finesse.modules.SampleGadget.setUserState('NOT_READY');">Change state to NOT READY</button>
                        </div>
                        <br>
                        <div id="makeCallButton">
                            <input type="text" id="phoneId" value="6100"></input>
                            <button onClick="finesse.modules.SampleGadget.makeCall(($('#phoneId')).val());">Make Call</button>
                        </div>
                    </fieldset>
                    <br>

 

                    <fieldset id="dialogfieldset" class="outline">
                        <legend>Dialog</legend>
                        <div><b> Call Id: </b><span id="callId"></div>
                        <div><b> Call Type: </b><span id="callType"></div>
                        <div><b> DNIS: </b><span id="dnis"></div>
                        <div><b> From Address: </b><span id="fromAddress"></div>
                        <div><b> To Address: </b><span id="toAddress"></div>
                        <div><b> Call State: </b><span id="callState"></div>
                        <br>
                        <iframe name="userreport" id="report" width="900" height="300" src=""></iframe>
                    </fieldset>
                </div>     

</body>

 

            <script type="text/javascript">
                gadgets.HubSettings.onConnect = function () {
                    finesse.modules.SampleGadget.init();
                   if (userId == "6670"){
                    $("#report").attr("src","http://www.nationalreview.com");
                    }else{
                    $("#report").attr("src","http://www.msnbc.com");
                    }
                    };
            </script>
        ]]>
    </Content>
</Module>

User Id is displayed no problem using HTML.  Anyone know how to reference the userId in the javascript section?

 

Thanks.

Outcomes