function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anurag DathathreyaAnurag Dathathreya 

How to load the opencti_min.js file in your VisualForce Pages?

Trying to connect to Open CTI library in sandbox using visualforce pages to only leverage the below functions from the library:
1) sforce.opencti.hvs.onWorkStart
2) sforce.opencti.hvs.completeWork
 

Visualforce Page Documentation:
1) <script src="/support/api/50.0/lightning/opencti_min.js" type="text/javascript"></script>

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


Third Party Domain Documentation
1) <script src="https://<<MyDomainName>>--<<Sandboxname>>--<<PackageName>>.visualforce.com/support/api/50.0/lightning/opencti_min.js" type="text/javascript"></script>

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

2) We are correctly putting the MyDomainName--Sandbox, is there a separate package that needs to be installed in the org for opencti_min.js to work? 

 

So all the above script tags have been tried out and we are still facing the error "Uncaught Failed to initialize Open CTI. Ensure that it is loaded from the right frame with correct URL parameters", we have exhausted the search results regarding this issue and the documentation does not mention anything regarding loading it from the right frame and also any parameters that needs to be called when loading the javascript 'opencti_min.js' file.

Looking forward towards a detailed explaination as to where to include parameters if needed and how to include them as well, and also where can I include this visualforce page in the page layout to only do one job which is to leverage the two HVS methods: completeWork and onWorkStart?
 

Gordon EngelGordon Engel
The exception is looking for URL parameters for sfdcIframeOrigin. Here's the generic answer from a previous question. I don't know if this helps your Visualforce use case or not:

https://developer.salesforce.com/forums/?id=9060G000000MOplQAG
Anurag DathathreyaAnurag Dathathreya

Hey Gordon,

I did take a look at that forum when I was first trying to find answers but turns out sfdcIframOrigin parameter did not do the trick, I tried the following script tags:

1) <script src="/support/api/50.0/lightning/opencti_min.js" type="text/javascript" sfdcIframeOrigin="<<DomainName>>"></script>
2)<script src="https://<<MyDomainName>>--<<Sandboxname>>--<<PackageName>>.visualforce.com/support/api/50.0/lightning/opencti_min.js?sfdcIframeOrigin=<<MyDomainName>>" type="text/javascript"></script>
3)<script src="/support/api/50.0/lightning/opencti_min.js?sfdcIframeOrigin=<<MyDomainName>>" type="text/javascript"></script>

 

I'm still facing the error "Uncaught Failed to initialize Open CTI. Ensure that it is loaded from the right frame with correct URL parameters", have you ever worked with opencti_min.js by the way?

Varun GaurVarun Gaur
Did you get any solutions? for this problem.