09-07-2016 10:20 AM
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.
Solved! Go to Solution.
09-07-2016 02:32 PM
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
09-07-2016 02:32 PM
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
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