0

I am getting the below error in Lightning Console when call comes in and getting below error.

Error: Uncaught Failed to initialize Open CTI. Ensure that it is loaded from the right frame with correct URL parameters

Code Screenshot - enter image description here

<apex:includeScript value="/support/api/40.0/lightning/opencti_min.js"/>
<script type="text/javascript"> 
    /*
    function sendPM() { 
        document.getElementById("log").innerHTML+= 'sending getCallCenterSettings <br />'; 
        window.sforce.interaction.cti.getCallCenterSettings(function (response) { 
            document.getElementById("log").innerHTML+= 'getCallCenterSettings successful <br />' 
            console.log('getCallCenterSettings successful'); 
        }); 
        document.getElementById("log").innerHTML+= 'sending non OpenCti PostMessage <br />'; 
        window.parent.postMessage("demo", "*"); 
    } 

    var callback = function(response) {
         sendPM();
         console.log('test call');
         if (response.success) {
            console.log('API method call executed successfully! returnValue:', response.returnValue);
         } else { 
            console.error('Something went wrong! Errors:', response.errors);
         }
        };
    function screenPop() {
        console.log('test call2');
        //sforce.opencti.screenPop({type: sforce.opencti.SCREENPOP_TYPE.SOBJECT, params: {scope:"Case"}, callback: callback  });
        sforce.opencti.searchAndScreenPop({ 
            'Acme', 
            'ANI=41555512121&DNIS=8006661234',
            'inbound', 
            callback 
        });
    }
    screenPop();
            */

    var openSuccess = function(result){
        if(result.success == false){
            alert('Case {!caseNumber} is already opened in another tab.');
        }
    }
    var showTabId = function(result) {
        //console.log('ResultId: ' + result.id);
        sforce.console.openPrimaryTab(result.id, '/{!caseId}', true, '{!caseNumber}', openSuccess, '');

    };
    function GetFocusedPrimaryTabId() {
        sforce.console.getFocusedPrimaryTabId(showTabId);
    }
    GetFocusedPrimaryTabId();

</script> 

Regards Nirmallya

2

0

You must log in to answer this question.

Browse other questions tagged .