getSoftphoneLayout() for Lightning Experience

Usage 

Returns the softphone layout of the current user. This method is available in API version 38.0 or later.

The Open CTI for Lightning Experience methods screenPop() and searchAndScreenPop() don’t support screenPopSettings.

Syntax 

1sforce.opencti.getSoftphoneLayout({
2  callback: FUNCTION,
3});

Arguments 

NameTypeDescription
callbackfunctionJavaScript method executed when the API method call is completed.

Sample Code–HTML and JavaScript 

1<html>
2  <head>
3    <script
4      type="text/javascript"
5      src="https://domain:port/support/api//lightning/opencti_min.js"
6    ></script>
7    <script type="text/javascript">
8      var callback = function (response) {
9        if (response.success) {
10          alert(response.returnValue);
11        } else {
12          console.error(response.errors);
13          alert("Something went wrong. Please check error information in developer console.");
14        }
15      };
16
17      function getSoftphoneLayout() {
18        sforce.opencti.getSoftphoneLayout({
19          callback: callback,
20        });
21      }
22    </script>
23  </head>
24  <body>
25    <button onclick="getSoftphoneLayout();">Get Softphone Layout</button>
26  </body>
27</html>

Response 

This method is asynchronous. The response is returned in an object passed to a callback method. The response object contains the following fields.

NameTypeDescription
successbooleantrue if the API call succeeded and the softphone layout definition is returned in returnValue; false otherwise.
returnValueobjectThe softphone layout definition if the call succeeded; null if it failed. See returnValue Fields.
errorsarraynull if the call succeeded. Otherwise, an array of error messages.

returnValue Fields 

The returned object contains three keys, "Internal", "Inbound", and "Outbound", one for each call type. Each call-type object has the these fields.

callRelatedFields

An array of call-related fields selected to display. Possible values are "ANI", "DNIS", "SEGMENT", and "QUEUE".

objects

The set of Salesforce objects selected to display, along with the Field Label and Field Name (API name) selected to display from each object.

screenPopSettings

Contains a screenPopsOpenWithin field with a value of either "ExistingWindow" or "NewWindow".

Also contains settings for each screen pop match type: "NoMatch", "SingleMatch", and "MultipleMatches". Each match type has a screenPopType field and an optional screenPopData field.

screenPopType valuescreenPopData value
"PopToEntity"Name of the target object.
"PopToVisualforce"Name of the target Visualforce page.
"PopToSearch"Not present.
"PopToFlow"Name of the target flow.

Example returnValue 

1{
2  "Internal" : {
3    "callRelatedFields" : ["ANI", "DNIS"],
4    "objects" : {
5      "User" : [{ "displayName" : "Name", "apiName" : "Name" }]
6    },
7    "screenPopSettings" : {}
8  },
9  "Inbound" : {
10    "callRelatedFields" : ["ANI", "DNIS", "SEGMENT", "QUEUE"],
11    "objects" : {
12      "Account" : [{ "displayName" : "Account Name", "apiName" : "Name" }]
13    },
14    "screenPopSettings" : {
15      "NoMatch" : { "screenPopType" : "PopToEntity", "screenPopData" : "Contact" },
16      "SingleMatch" : { "screenPopType" : "PopToVisualforce", "screenPopData" : "Visualforce_Page_Name" },
17      "MultipleMatches" : { "screenPopType" : "PopToSearch" }
18    }
19  },
20  "Outbound" : {
21    "callRelatedFields" : ["DNIS"],
22    "objects" : {
23      "Account" : [{ "displayName" : "Account Name", "apiName" : "Name" }]
24    },
25    "screenPopSettings" : {}
26  }
27}