2

Trying to load Open CTI library in #LWC. Getting warning "Evaluation error [Failed to initialize Open CTI. Ensure that it is loaded from the right frame with correct URL parameters]" Am I missing anything?

step1: Load open CTI library into static resource from https://domain:port/support/api/49.0/lightning/opencti_min.js

step2: Try to load the static resource in LWC component -

connectedCallback() {
        Promise.all([
            loadScript(this, OpenCTIResource + '/opencti_min.js')
        ]).then(() => {
            console.log('ConnectedCallBack.. script loaded..!!');
            sforce.opencti.getAppViewInfo({callback: appViewInfoCallback});
        }).catch(error => {
            console.log('Error msg : ', error);
        });
    }

Note - I can see the OpenCTI file is loaded under resources of chrome debugger, but simultaneously getting warning saying - "Evaluation error [Failed to initialize Open CTI. Ensure that it is loaded from the right frame with correct URL parameters]"

Please suggest.

4

Open CTI is not yet supported in the LWC!

Even if you manage to solve it, as of today you won’t get much support on this as it is not officially supported!

There are couple of alternate approach you can take

  1. Use aura components and in aura components you can access sforce methods easily!

A sample app to show this is in below git

https://github.com/developerforce/open-cti-demo-adapter

  1. Use visualforce with lightning out and pass around the sforce object using LMS(lightning messaging service)
| improve this answer | |
  • 1
    Thanks Mohit for your reply. – user1084921 Aug 5 at 18:11
  • agree to your approach and conclusion. But still, just to check with few methods of Open CTI in LWC, is there any solution to load the opencti_min.js correctly and make a call to at least one method? – user1084921 Aug 5 at 19:51
  • Can you test it using the utility bar? How are you testing it? Also, turn your chrome debugger to let me know which line is causing the issue. – Mohith Shrivastava Aug 5 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.