cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
949
Views
1
Helpful
1
Replies

Finesse Gadgets parsing user ID in xml

bruce.finney
Level 1
Level 1

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.

1 Accepted Solution

Accepted Solutions

dekwan
Cisco Employee
Cisco Employee

Hi,

I would suggest putting that code in the SampleGadget.js file because the user object with the user id is already created and all you would have to do is user.getId(). So, you can create another method in the SampleGadget.js file and put that code in where userId is user.getId(). Then after the SampleGadget.init() you see there, call that method you created.

Just FYI, someone made a Call History Gadget that is posted on DevNet creations. You might want to take a look: https://developer.cisco.com/site/devnetcreations/detail.gsp?submitId=181004

Thanx,

Denise

View solution in original post

1 Reply 1

dekwan
Cisco Employee
Cisco Employee

Hi,

I would suggest putting that code in the SampleGadget.js file because the user object with the user id is already created and all you would have to do is user.getId(). So, you can create another method in the SampleGadget.js file and put that code in where userId is user.getId(). Then after the SampleGadget.init() you see there, call that method you created.

Just FYI, someone made a Call History Gadget that is posted on DevNet creations. You might want to take a look: https://developer.cisco.com/site/devnetcreations/detail.gsp?submitId=181004

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: