Update Call Data using Finesse Gadget

Version 1
    This document was generated from CDN thread

    Created by: yogesh kumar on 08-11-2013 10:27:32 AM
    During an incoming call I want to update call data (eg. Call variable 1) and then transfer the call. I can see API for the same using Finesse API but I am not sure how I acchive the same using Finesse gadget API.

    Subject: RE: New Message from yogesh kumar in Finesse - General Questions: Update Ca
    Replied by: David Lender on 08-11-2013 12:02:44 PM
    The finesse gadget javascript does not provide a method to update call variables only one to updateWrapUpReason.  Look for updateCallVariable in a future release.

    To transfer  a call use the Dialog.initiateDirectTransfer method of Dialog.

    Subject: RE: New Message from yogesh kumar in Finesse - General Questions: Update Ca
    Replied by: Joseph Horvath on 08-11-2013 05:32:28 PM
    It's quite easy to add the JavaScript code that is required to modify Call Variables. Just pattern it after the "updateWrapUpReason" code.

    Subject: RE: New Message from Joseph Horvath in Finesse - General Questions: RE: New
    Replied by: Jin Tiam Loh on 08-11-2013 09:59:45 PM
    Hi,



    Does this mean the only way (currently) to update the call variables is to send them back into IVR? Or its possible based on Joseph recommendation?



    Thanks!

    -JT-

    Subject: RE: New Message from Joseph Horvath in Finesse - General Questions: RE: New
    Replied by: Jin Tiam Loh on 08-11-2013 09:59:44 PM
    Hi,



    Does this mean the only way (currently) to update the call variables is to send them back into IVR? Or its possible based on Joseph recommendation?



    Thanks!

    -JT-

    Subject: RE: New Message from yogesh kumar in Finesse - General Questions: Update Ca
    Replied by: yogesh kumar on 09-11-2013 01:39:43 AM
    Joseph Horvath:
    It's quite easy to add the JavaScript code that is required to modify Call Variables. Just pattern it after the "updateWrapUpReason" code.

    How can I do it…. Right now iam setting wrap up like this:
                                    ActiveDialog.updateWrapUpReason(wrapUpReason, {
                                    success: setWrapupReasonSuccess,
                                    error: setWrapupReasonError
                                    });          
    Do I need to append call variable in this function only(How?) or just after it.
                    

    Subject: RE: New Message from Joseph Horvath in Finesse - General Questions: RE: New
    Replied by: Joseph Horvath on 11-11-2013 09:09:57 AM
    Something like this (for Finesse 9.x):

       /**
         * Update a Call Variable in this dialog.
         *
         * @param {String} name
         *     The Call Variable Name in this dialog
         * @param {String} value
         *     The new value for this named Call Variable in this dialog
         * @param {Object} handlers
         *     An object containing the following (optional) handlers for the request:<ul>
         *         <li><b>success(rsp):</b> A callback function for a successful request to be invoked with the following
         *         response object as its only parameter:<ul>
         *             <li><b>status:</b> {Number} The HTTP status code returned</li>
         *             <li><b>content:</b> {String} Raw string of response</li>
         *             <li><b>object:</b> {Object} Parsed object of response</li></ul>
         *         <li>A error callback function for an unsuccessful request to be invoked with the
         *         error response object as its only parameter:<ul>
         *             <li><b>status:</b> {Number} The HTTP status code returned</li>
         *             <li><b>content:</b> {String} Raw string of response</li>
         *             <li><b>object:</b> {Object} Parsed object of response (HTTP errors)</li>
         *             <li><b>error:</b> {Object} Wrapped exception that was caught:<ul>
         *                 <li><b>errorType:</b> {String} Type of error that was caught</li>
         *                 <li><b>errorMessage:</b> {String} Message associated with error</li>
         *             </ul></li>
         *         </ul>
         */
        updateCallVariable: function (name, value, options)
        {
            this.isLoaded();

            var callvariables =
                {
                    "CallVariable" :
                    {
                        "name" : name,
                        "value" : value
                    }
                };

            var mediaProperties =
            {
                "callvariables" : callvariables
            };

            options = options || {};
            options.content = {};
            options.content[this.getRestType()] =
            {
                "requestedAction": finesse.restservices.Dialog.Actions.UPDATE_CALL_DATA,
                "mediaProperties": mediaProperties
            };
            options.method = "PUT";
            this.restRequest(this.getRestUrl(), options);

            return this;
        }
    ,

    Subject: RE: Update Call Data using Finesse Gadget
    Replied by: yogesh kumar on 12-11-2013 11:24:29 AM
    Hi Joseph,
    Thanks for providing the code snippet to update call variable. It worked for me. However I am not very sure how you done. There is no mention of this in any of the documents. Can you please explain me the process so I can probably use it somewhere else where documents does not described these methods.

    Thanks

    Subject: RE: Update Call Data using Finesse Gadget
    Replied by: Joseph Horvath on 12-11-2013 12:54:37 PM
    The code simply builds an XML request (as per the Cisco Finesse Web Services Developer Guide description of "Dialog - Update Call Variable Data") and submits it using the Finesse JavaScript Gadget library.