searchAndScreenPop() for Lightning Experience
Searches objects specified in the softphone layout for a given string. Returns search results and screen pops any matching records. This method respects screen pop settings defined in the softphone layout. This method is available in API version 38.0 or later.
The returned response displays only matches that meet your softphone layout settings. However, the search page that screen pops, displays all matches, regardless of the objects you specify in your sofpthone layout.
The searchAndScreenPop() method for Lightning Experience works differently from the Salesforce Classic method.
- Open CTI for Lightning Experience doesn’t support the softphone layout field
Screen pops open withinwhen the value isNew browser window or tab. In Lightning Experience, the default value isExisting browser window. - Open CTI for Lightning Experience provides a new argument called
deferred.
The searchAndGetScreenPopUrl() method is not available in the Open CTI API for Lightning Experience. To accomplish the same functionality in Lightning Experience, use the deferred parameter available in this method. Pass the value in SCREEN_POP_DATA from the return object into the screenPop () method.
If you’re noticing inconsistent behavior with the default settings of your softphone layout, edit your softphone layout to force the cache to refresh. From Setup, edit your softphone layout and save the changes. Then edit the layout again and reset the layout to the default settings.
| Name | Type | Description |
|---|---|---|
searchParams | string | String to search. |
queryParams | string | Specifies the query parameters to pass to the URL. Query parameters are only passed to the URL if the screen pop option is set to Pop to Visualforce. |
params | object | Specifies arguments to pass to a flow. flowArgs is a list of objects with key-value pairs containing information about the arguments being passed to the flow. Arguments must correspond to input variables of the specified name and type defined in the flow, else they are ignored. This argument can only be used with flows. Consult the FlowVariable section in the topic on Flow in the Metadata API Developer Guide for details on flow arguments. |
defaultFieldsValue | object | Optional. If you set up your softphone to pop to a new entity when there are no search results (for inbound calls), use this argument to specify the default fields for the screen pop. When the screen pop opens for the new entity, it’s pre-populated with the fields you’ve specified. |
callType | string | Required. Specifies the type of call—inbound, outbound, internal, or null. Per the settings in the softphone layout, the call type determines which objects to search for any matches. Specify one of the following values: sforce.opencti.CALL_TYPE.INBOUND, sforce.opencti.CALL_TYPE.OUTBOUND, or sforce.opencti.CALL_TYPE.INTERNAL. |
deferred | boolean | Specifies whether the screen pop is performed immediately following the search or deferred until later. Set to false (default) for an immediate screen pop. Set to true to defer — a JSON object is returned in the SCREEN_POP_DATA key, which must be passed unmodified to sforce.opencti.screenPop to perform the screen pop. |
callback | function | JavaScript method executed when the API method call is completed. |
Example params value:
Example defaultFieldsValue call:
| Name | Type | Description |
|---|---|---|
success | boolean | Returns true if the API method call was invoked successfully, false otherwise. |
returnValue | object | Returns a list of objects that match the search results. The search is performed on the objects specified in the softphone layout. For each object found, the object ID, object type, last modified date, field names, and field values are returned as JSON objects. Make sure that you specify fields to return in your softphone layout. If you don’t, nothing is returned. When invoked on an account or contact object, AccountId or PersonContactId and IsPersonAccount are also returned. |
errors | array | If the API call was successful, this variable is null. If the API call failed, this variable returns an array of error messages. |
Example returnValue when searching for “Acme” (one Account and three Opportunity objects found):
Example returnValue when using the deferred parameter (no screen navigation occurs):
Example returnValue for an account or contact object (includes person account fields):