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.

1 Answer 1

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)
4
  • 1
    Thanks Mohit for your reply. Commented Aug 5, 2020 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? Commented Aug 5, 2020 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. Commented Aug 5, 2020 at 19:57
  • Is Open CTI still not supported in LWC as per Spring 23 ?
    – wesaw
    Commented Apr 18, 2023 at 17:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .