<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Finesse gadget making a direct transfer button in Contact Center</title>
    <link>https://community.cisco.com/t5/contact-center/finesse-gadget-making-a-direct-transfer-button/m-p/4314549#M11844</link>
    <description>&lt;P&gt;HI all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am very new to Finesse coding and wondering if someone wold be able to shed some light on what I am doing wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var finesse = finesse || {};
finesse.gadget = finesse.gadget || {};
finesse.container = finesse.container || {};
clientLogs = finesse.cslogger.ClientLogger || {};  // for logging
/*global logFinesse */

/** @namespace */
finesse.modules = finesse.modules || {};

finesse.modules.Transfer = (function ($) {
    var clientLogs, user, dialog,

    populateGadget = function () { 
        var currentState = user.getState();

        $("#userId").text(user.getId());
        $("#firstName").text(user.getFirstName());
        $("#lastName").text(user.getLastName());

        if (user.hasSupervisorRole()) {
            $("#userRole").text('Supervisor');
        } else {
            $("#userRole").text('Agent');
        }

        $("#extension").text(user.getExtension());
        $("#userState").text(currentState);
        $("#teamId").text(user.getTeamId());
        $("#teamName").text(user.getTeamName());

        gadgets.window.adjustHeight();
    },

        /**
     * Handler for makeCall when successful.
     */
    makeCallSuccess = function(rsp) { },
    
    /**
     * Handler for makeCall when error occurs.
     */
    makeCallError = function(rsp) {
        $('#errorMsg').html(_util.getErrData(rsp));
    },

    handleUserChange = function(userevent) { populateGadget(); },

    handleUserLoad = function (userevent) { populateGadget(); };

    handleTransferSuccess = function(userevent) {  },

    handleTransferError = function (userevent) { };

    /** @scope finesse.modules.SampleGadget */
    return {
         /**
          * Performs all initialization for this gadget
          */
        initiateDirectTransfer: function ( tooExt ) {
            userExt = user.getExtension();
            dialog.initiateDirectTransfer( userExt, tooExt, {
                success: makeCallSuccess,
                error: makeCallError
            });
        },


        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, "Transfer", finesse.gadget.Config); //this gadget id will be logged as a part of the message

            dialog = new finesse.restservices.Dialog({
                id: id,
                onLoad : handleTransferSuccess,
                onChange : handleTransferError
            });

            user = new finesse.restservices.User({
                id: cfg.id, 
                onLoad : handleUserLoad,
                onChange : handleUserChange
            });


        }
    };
}(jQuery));&lt;/PRE&gt;&lt;P&gt;Currently the issue is that user is not defined on the line containing "userExt = user.getExtension();" inside the "initiateDirectTransfer" function, I can not for the life of me work out how to get this to work.&amp;nbsp; Could someone either explain the errors or point me in the right direction of some decent docs/tutorials that will help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Damian&lt;/P&gt;</description>
    <pubDate>Fri, 26 Mar 2021 14:57:19 GMT</pubDate>
    <dc:creator>DamianSnowden00261</dc:creator>
    <dc:date>2021-03-26T14:57:19Z</dc:date>
    <item>
      <title>Finesse gadget making a direct transfer button</title>
      <link>https://community.cisco.com/t5/contact-center/finesse-gadget-making-a-direct-transfer-button/m-p/4314549#M11844</link>
      <description>&lt;P&gt;HI all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am very new to Finesse coding and wondering if someone wold be able to shed some light on what I am doing wrong.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is the code I am using:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;var finesse = finesse || {};
finesse.gadget = finesse.gadget || {};
finesse.container = finesse.container || {};
clientLogs = finesse.cslogger.ClientLogger || {};  // for logging
/*global logFinesse */

/** @namespace */
finesse.modules = finesse.modules || {};

finesse.modules.Transfer = (function ($) {
    var clientLogs, user, dialog,

    populateGadget = function () { 
        var currentState = user.getState();

        $("#userId").text(user.getId());
        $("#firstName").text(user.getFirstName());
        $("#lastName").text(user.getLastName());

        if (user.hasSupervisorRole()) {
            $("#userRole").text('Supervisor');
        } else {
            $("#userRole").text('Agent');
        }

        $("#extension").text(user.getExtension());
        $("#userState").text(currentState);
        $("#teamId").text(user.getTeamId());
        $("#teamName").text(user.getTeamName());

        gadgets.window.adjustHeight();
    },

        /**
     * Handler for makeCall when successful.
     */
    makeCallSuccess = function(rsp) { },
    
    /**
     * Handler for makeCall when error occurs.
     */
    makeCallError = function(rsp) {
        $('#errorMsg').html(_util.getErrData(rsp));
    },

    handleUserChange = function(userevent) { populateGadget(); },

    handleUserLoad = function (userevent) { populateGadget(); };

    handleTransferSuccess = function(userevent) {  },

    handleTransferError = function (userevent) { };

    /** @scope finesse.modules.SampleGadget */
    return {
         /**
          * Performs all initialization for this gadget
          */
        initiateDirectTransfer: function ( tooExt ) {
            userExt = user.getExtension();
            dialog.initiateDirectTransfer( userExt, tooExt, {
                success: makeCallSuccess,
                error: makeCallError
            });
        },


        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, "Transfer", finesse.gadget.Config); //this gadget id will be logged as a part of the message

            dialog = new finesse.restservices.Dialog({
                id: id,
                onLoad : handleTransferSuccess,
                onChange : handleTransferError
            });

            user = new finesse.restservices.User({
                id: cfg.id, 
                onLoad : handleUserLoad,
                onChange : handleUserChange
            });


        }
    };
}(jQuery));&lt;/PRE&gt;&lt;P&gt;Currently the issue is that user is not defined on the line containing "userExt = user.getExtension();" inside the "initiateDirectTransfer" function, I can not for the life of me work out how to get this to work.&amp;nbsp; Could someone either explain the errors or point me in the right direction of some decent docs/tutorials that will help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Damian&lt;/P&gt;</description>
      <pubDate>Fri, 26 Mar 2021 14:57:19 GMT</pubDate>
      <guid>https://community.cisco.com/t5/contact-center/finesse-gadget-making-a-direct-transfer-button/m-p/4314549#M11844</guid>
      <dc:creator>DamianSnowden00261</dc:creator>
      <dc:date>2021-03-26T14:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Finesse gadget making a direct transfer button</title>
      <link>https://community.cisco.com/t5/contact-center/finesse-gadget-making-a-direct-transfer-button/m-p/4314656#M11845</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The user variable is not defined until the init function is called. But even if you fix that issue, the dialog object is not within the scope of that function. So I would suggest that you take a look at the &lt;A href="https://github.com/CiscoDevNet/finesse-sample-code/tree/master/UpdateCallVariableDataSampleGadget" target="_self"&gt;UpdateCallVariableDataSampleGadget&lt;/A&gt; to see how to store the dialog object to use the dialog's methods. The only thing for your gadget is that you do not need to call the raw REST API request that you see in the&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;updateCallVariable function.&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;Instead the updateCallVariable function should be as simple as:&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;
&lt;PRE&gt;&lt;SPAN&gt;updateCallVariable&lt;/SPAN&gt;&lt;SPAN&gt; = &lt;/SPAN&gt;&lt;SPAN&gt;function&lt;/SPAN&gt;&lt;SPAN&gt;(&lt;/SPAN&gt;&lt;SPAN&gt;name&lt;/SPAN&gt;&lt;SPAN&gt;, &lt;/SPAN&gt;&lt;SPAN&gt;value&lt;/SPAN&gt;&lt;SPAN&gt;) {&lt;BR /&gt;&lt;/SPAN&gt;if (currentDialog) {
    clientLogs.log("updateCallVariable(): ...");
    currentDialog.initiateDirectTransfer( userExt, tooExt, {
        success: makeCallSuccess,
        error: makeCallError
     });
} else {&lt;BR /&gt;    clientLogs.log("updateCallVariable(): There are currently no active dialogs");&lt;BR /&gt;}&lt;BR /&gt;}&lt;/PRE&gt;
&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;I hope that helps.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Thanx,&lt;/DIV&gt;
&lt;DIV&gt;Denise&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Fri, 26 Mar 2021 19:03:29 GMT</pubDate>
      <guid>https://community.cisco.com/t5/contact-center/finesse-gadget-making-a-direct-transfer-button/m-p/4314656#M11845</guid>
      <dc:creator>dekwan</dc:creator>
      <dc:date>2021-03-26T19:03:29Z</dc:date>
    </item>
  </channel>
</rss>

