cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1750
Views
15
Helpful
16
Replies

Re: UpdateCallVarible Sample Gadget

rufaidashafik21170
Spotlight
Spotlight

Hey i have a JSON API 'https://safe-stream-34164.herokuapp.com/' and I have the following requirements:

 

1. The agent can select the required Menu/Submenu and click the Transfer Button 

2. As soon as the agent click the transfer button, Gadget will store the values of Menu and Sub Menus into the call variable (for example Menu=CallVariable1, sub-menu=CallVariable2)

 

I am new to cisco not getting how to update the call variables by getting the id from JSON file any help would be appreciated 

Thanks in advance

1 Accepted Solution

Accepted Solutions

I couldnt be able to write it was continuesly giving error hope it helps

Screenshot (409).pngScreenshot (408).png

View solution in original post

16 Replies 16

dekwan
Cisco Employee
Cisco Employee

Hi,

 

As you can see, I created a new discussion thread with your question. This way the responses won't get intertwined with the old post.

 

Are you using the UpdateCallVariableSampleGadget: https://github.com/CiscoDevNet/finesse-sample-code/tree/master/UpdateCallVariableDataSampleGadget ?

 

What do you mean when you say "not getting how to update the call variables by getting the id from JSON file"?

 

Also, once the call is transferred, you cannot update the call variables if you are not on wrap up. So, I would suggest that when the transfer button is pressed, you update the call variables first, then complete the transfer.

 

Please explain your code with more detail in order for me to help you further.

 

Thanx,

Denise

 

 

Hey yes i am using https://github.com/CiscoDevNet/finesse-sample-code/tree/master/UpdateCallVariableDataSampleGadget 

I have deployed my json file on finesse server and accesing like this 

now i want to display the names defined in json file and on clicking each name i want to store its value as callVariable1 so i did this
.then(res => res.json())
            .then(data => {
                console.log(data)
    
                document.querySelector("#app").innerHTML = data.map(user => {
                    return `<li class="list"><a href="#"> ${user.name}</a></li>`
    
    
                })
            })
            .catch(() => console.log('cant'))
            html += ' <ul id="app" ></ul>'

            $("#app").on("click""a"function (e) {
            $this ).css("color""red")
            e.preventDefault()
            console.log($(this).text())
            updateCallVariable('callVariable1',$(this).text() )
        })
I am calling the updateCallVariable function on clicking the name values but its not working kindly help im new to finesse

Hi,

 

Ok. Understood that you want to store the value from the JSON. Looks like you got that part working, but can you explain what is not working? Are you getting an error in the console? Is the REST API request being made but getting an error back? Can you provide the logs? Did you try to step through the updateCallVariable method to see where it is having issues?

 

I need more details about what is not working in order for me to help you.

 

Thanx,

Denise

I am displaying it in displayCallVariables I have tried this code in other file its working, on clicking its getting the value but here it is not getting the value of names which i am retrieving . so i wanna know how to get the value of names on clicking and then storing its value in callvariable1 . I dont think iam calling updateCallVariable correctly .

  displayCallVariables = function (dialog) {
        // Check to see if the user has UPDATE_CALL_DATA as an allowable action
      
        if(isUCDAllowableAction(dialog)) {
            // The user has UPDATE_CALL_DATA as an allowable action
            // Build the list of call variables that can be updated
           

            // var callVariables = dialog.getMediaProperties();
            html = '<div id="main" >';;
            // var i = 1;
            .then(res => res.json())
            .then(data => {
                console.log(data)
    
                document.querySelector("#app").innerHTML = data.map(user => {
                    return `<li class="list"><a href="#"> ${user.name}</a></li>`
    
    
                })
            })
            .catch(() => console.log('cant'))
            html += ' <ul id="app" ></ul>'

            $("#app").on("click""a"function (e) {
            $this ).css("color""red")
            e.preventDefault()
            console.log($(this).text())
            updateCallVariable('callVariable1',$(this).text() )
        })
 // html += "<button onClick=\"finesse.modules.SampleGadget.updateCallVariable('callVariable1','blah' );\">Update </button>";

            // for (var callVariableName in callVariables) {
            //     clientLogs.log("displayCallVariables(): key is: " + callVariableName);
            //     if ((callVariableName !== 'DNIS') && (callVariableName !== 'callType') &&
            //         (callVariableName !== 'dialedNumber') && (callVariableName !== 'outboundClassification')) {
            //         var inputId = "CallVariable" + i;
                  
            //         html += "<input type=\"text\" id=\"" + inputId + "\" placeholder=\"" + callVariableName + "\"></input>";
            //         html += "<button onClick=\"finesse.modules.SampleGadget.updateCallVariable('" + callVariableName + "', ($('#" + inputId + "')).val());\">Update " + callVariableName + "</button>";
            //         html += "<br>";
            //         i++;
            //     }
            // }
            // html += '</div>';
 

Hi,

 

I'm sorry but you are still not giving me the details I need to help. You are saying that the issue is the update call variable, but you are not giving me the details of this part. I need details of your issues AFTER the call to updateCallVariable. 

 

In the existing code, it logs "updateCallVariable(): Updating " + name + " to " + value + " for dialog with id: " + currentDialog.getId()" if a current dialog exists or "updateCallVariable(): There are currently no active dialogs" if it doesn't. What do you see in the console? If you do not see anything, then do you see the log you added to print the value (console.log($(this).text()))? Did you use the browser's debugger to step through the updateCallVariable method to see where it is being stuck?

 

Thanx,

Denise

I am getting the values from JSON but on clicking them nothing is happening as you see in this picScreenshot (406).png

Hi,

 

I suggest adding more meaningful log statements. Is the Array(6) log the one that matches console.log(data)? If so, I do not see the log statement for console.log($(this).text()), which means that it isn't even getting to the updateCallVariable method.

 

You should probably use breakpoints in the developer tool: https://developers.google.com/web/tools/chrome-devtools/javascript/breakpoints so that you can see which line of code is having issues.

 

Also, I don't think I quite understand what your code is doing in terms of trying to get the values. What is $(this).text() returning?

 

Earlier, you said that the updateCallVariable is not working, but it now seems like you are having issues getting the right values from your JSON. So where exactly is the issue? You will be able to figure this out if you used the breakpoints and found the exact line of code.

 

Thanx,

Denise

$(this).text() is returning the value name which i want to update in call variable let me show you

This is my other file in which its getting the value 

Screenshot (407).png

Here are both my folders attached can you review them also let me try breakpoints in developer tool

The problem is my jquery onclick function isnt working inside dialog in updatecallvariables.js file

$(this).text() is returning the value name which i want to update in call variable let me show you

This is my other file in which its getting the value I tried my code in it for testing purpose to see if I am doing okay

Screenshot (407).png

Here are both my folders attached can you review them also let me try breakpoints in developer tool

I got it solved! 

Thankyou so much

Good to hear that you figured it out. What ended up being the solution? And if you don't mind, can you post it for others who may run into the same issue?

 

Thanx,

Denise

i

I couldnt be able to write it was continuesly giving error hope it helps

Screenshot (409).pngScreenshot (408).png