searchAndScreenPop() for Salesforce Classic
Usage
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.
Syntax
sforce.interaction.searchAndScreenPop(searchParams:string, queryParams:string, callType:string, (optional) callback:function);
Arguments
Name | Type | Description |
---|---|---|
searchParams | string | String to search. |
queryParams | string | Specifies the query parameters to pass to the URL. |
callType | string | Specifies the type of call, such as inbound,
outbound, internal, or null. Per the settings in the softphone layout,
the call type determines which objects to search for any
matches. If callType is null, searches are inbound by default. If callType is internal or outbound, no screen pops occur. |
callback | function | JavaScript method executed when the API method call is completed. |
Sample Code–JavaScript
<html>
<head>
<script type="text/javascript" src="http://domain:port/support/api/33.0/interaction.js"></script>
<script type="text/javascript">
var callback = function (response) {
if (response.result) {
alert(response.result);
} else {
alert(response.error);
}
};
function searchAndScreenPop() {
//Invokes API method
sforce.interaction.searchAndScreenPop('Acme', 'Key1=value1&Key2=value2', 'inbound', callback);
}
</script>
</head>
<body>
<button onclick="searchAndScreenPop();">searchAndScreenPop</button>
</body>
</html>
Response
Name | Type | Description |
---|---|---|
result | string | 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, field names, field
values, and for API version 33.0 or later, object tab names are
returned as a JSON string. The following is an example
of searching for “Acme,” and finding one account
and three opportunity
objects:
For
API version 31.0 and later, invoking this API method on a
PersonAccount object returns additional
information:
|
error | string | If the API call was successful, this variable is undefined. If the API call failed, this variable returns an error message. |