We are using a VF page as a CTI adapter. It does not seem to include sforce.one. I notice on other VF pages this is brought in as part of api.js, but I cannot put my finger on what it is about that VF page which brings in api.js when the CTI adapter page does not bring it in.

How do I access sforce.one from my VF page acting as a CTI adapter? Would it be a horrible idea to bring it in explicitly myself, as in

<apex:includeScript value="/sforce/one/50.0/api.js"/>

1 Answer 1


The recommended approach is documented in the Open CTI developer guide here

Using the below imports in Lightning Experience brings in the required sforce dependency

      <script src="/support/api/50.0/lightning/opencti_min.js" type="text/javascript"></script>

I tested by creating a simple vf page as shown below with the call center config as here

    <apex:page >
  <!-- Begin Default Content -->
    <h1>Sample Page in CTI!</h1>
    <!-- End Default Content -->
       <!-- Imports Open CTI JavaScript library. Point to a valid Salesforce 
    <script src="https://domain:port/support/api/50.0/lightning/opencti_min.js">.    </script>
  <script type="text/javascript">
   // Callback of API method: setSoftphonePanelHeight
    var setSoftphonePanelHeightCallback = function(response) {
        // Returns true if setSoftphonePanelHeight method is executed successfully, false otherwise
        if (response.result) {
           alert('setSoftphonePanelHeight is successfully executed.');
   // Invokes API method: setSoftphonePanelHeight
   function setSoftphonePanelHeight() {
        heightPX: 500,
        callback: setSoftphonePanelHeightCallback
   // Callback of API method: setSoftphonePanelWidth
       var setSoftphonePanelWidthCallback = function(response) {
        // Returns true if setSoftphonePanelWidth method is executed successfully, false otherwise
        if (response.result) {
           alert('setSoftphonePanelWidth is successfully executed.');
        else {
           alert('setSoftphonePanelWidth failed.');
   // Invokes API method: setSoftphonePanelWidth
   function setSoftphonePanelWidth() {
        widthPX: 500,
        callback: setSoftphonePanelHeightCallback
  <button onclick="setSoftphonePanelHeight();">setSoftphonePanelHeight({heightPX:500}). 
   <button onclick="setSoftphonePanelWidth();">setSoftphonePanelWidth({widthPX:500})</button><br/>

You can use the sforce.opencti.publish method to publish an LMS event directly to an LWC component that can be on the app page!

LWC component can help with you all the functions like navigation, refreshing or any other thing you need sforce.one for.

sforce.one is only available on top frame in lightning experience or in the Salesforce mobile app container

You can bring in sforce lib as you have mentioned in query but it is not documented method

  • Thank you very much. Could you kindly confirm that you also have access to sforce.one, since we need that to use LMS (sforce.one.publish)? We were actually already bringing in opencti.js, and we see sforce, but not sforce.one.
    – kamezaburo
    Commented Dec 14, 2020 at 1:41
  • I found out I can use sforce.opencti.publish. See developer.salesforce.com/docs/atlas.en-us.api_cti.meta/api_cti/….
    – kamezaburo
    Commented Dec 14, 2020 at 2:19
  • 1
    Exactly I was about to update this! You can use LMS there and use publish and then once in LWC you don't need sforce.one for anything! Commented Dec 14, 2020 at 2:21

You must log in to answer this question.

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