03-30-2021 12:06 PM
Hi,
Can you please help me how to pass agtExtn dynamically to initiateDirectTransfer in gadget? Case1 is working but not Case2 or Case3.
Case1 :- Hardcoded agentExtn; Transfer working
html += "<button class=\"btn btn-primary btn-block\" id=\"btn\" onClick=\"finesse.modules.SampleGadget.initiateDirectTransfer(1234567890,'8000000000');\">WRAP CALL </button>";
Case2:-Assigned var agtExtn = user.getExtension(); and passing agtExtn in single quote;Transfer Failing
html += "<button class=\"btn btn-primary btn-block\" id=\"btn\" onClick=\"finesse.modules.SampleGadget.initiateDirectTransfer('agtExtn','8000000000');\">WRAP CALL </button>";
Case3:-Assigned var agtExtn = user.getExtension(); and passing agtExtn without single quote;Transfer Failing
html += "<button class=\"btn btn-primary btn-block\" id=\"btn\" onClick=\"finesse.modules.SampleGadget.initiateDirectTransfer(agtExtn,'8000000000');\">WRAP CALL </button>";
Can you please help me why it is not working when passing agtExtn dynamically?
Solved! Go to Solution.
04-09-2021 07:50 PM
Hi,
Whilst Denise is correct in that you cannot execute js code in plain html, but I'm pretty sure that isn't your intent.
You appear to be building the html in javascript code, so you simply need to use quotes correctly to execute the call to the user.getExtension() function. At present you are literally adding "user.getExtension()" as part of the HTML.
So change your line to something like this:
html += '<button class="btn btn-primary btn-block" id="btn" onClick="finesse.modules.SampleGadget.initiateDirectTransfer('+user.getExtension()+',8000000000);">WRAP CALL </button>';
Regards,
Andrew
03-30-2021 01:10 PM
Hi,
If you want to pass in the agent's extension, you need to do that in the js file rather than the html. I would suggest removing that parameter from the finesse.modules.SampleGadget.initiateDirectTransfer method and within the initiateDirectTransfer method, use user.getExtension() in the dialog.initiateDirectTransfer method call.
I hope that helps.
Thanx,
Denise
03-30-2021 03:38 PM
Hi Denise,
My requirement is to initiateDirectTransfer after agent clicking button so am using below logic in JS file only.I have tried passing user.getExtension() directly in initiateDirectTransfer and still have problem.
html += "<button class=\"btn btn-primary btn-block\" id=\"btn\" onClick=\"finesse.modules.SampleGadget.initiateDirectTransfer(user.getExtension(),'8000000000');\">WRAP CALL </button>";
Are you suggesting same or to implement changes in below method.
initiateDirectTransfer: function (mediaAddress, toAddress) {
// clear the error message before making the call
$('#errorMsg').html("");
// Example of the user make call method
currentDialog.initiateDirectTransfer(mediaAddress, toAddress, {
success: makeCallSuccess,
error: makeCallError
});
Please advise.
03-30-2021 06:01 PM
Hi,
You cannot use user.getExtension in HTML code. You have to do it in the js part of the code.
I'm talking about this:
initiateDirectTransfer: function (mediaAddress, toAddress) { // clear the error message before making the call $('#errorMsg').html(""); // Example of the user make call method currentDialog.initiateDirectTransfer(mediaAddress, toAddress, { success: makeCallSuccess, error: makeCallError });
You need to remove the mediaAddress parameter and then the currentDialog.initiateDirectTransfer, you need to use user.getExtension(). So it should look like this:
initiateDirectTransfer: function (toAddress) { // clear the error message before making the call $('#errorMsg').html(""); // Example of the user make call method currentDialog.initiateDirectTransfer(user.getExtension(), toAddress, { success: makeCallSuccess, error: makeCallError });
Thanx,
Denise
04-09-2021 07:50 PM
Hi,
Whilst Denise is correct in that you cannot execute js code in plain html, but I'm pretty sure that isn't your intent.
You appear to be building the html in javascript code, so you simply need to use quotes correctly to execute the call to the user.getExtension() function. At present you are literally adding "user.getExtension()" as part of the HTML.
So change your line to something like this:
html += '<button class="btn btn-primary btn-block" id="btn" onClick="finesse.modules.SampleGadget.initiateDirectTransfer('+user.getExtension()+',8000000000);">WRAP CALL </button>';
Regards,
Andrew
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