Use the extension points to customize screen pop

Note: This article applies to Genesys Cloud for Salesforce.

You can use the extension points to customize screen pop behavior in Genesys Cloud for Salesforce. The extension points use the Salesforce Apex programming language. 

Note: This advanced customization article is intended for developers who are familiar with Salesforce.

Prerequisites

  • A version of the managed package that includes the Extension Point Settings section. For more information, see Configure extension points.

In Salesforce, create a single Apex file with an Apex class that implements the purecloud.CTIExtension.ScreenPop interface. Define the Apex class as global so the code can be called by the integration.

purecloud.CTIExtension.ScreenPop interface

Contains a method signature that you can define to customize the screen pop functionality in Genesys Cloud for Salesforce.

Usage

Use the method signature in the purecloud.CTIExtension.ScreenPop interface to define how the screen pop functionality works.

onScreenPop method

Used to drive screen pop logic.

This method is called for an inbound alerting interaction. onScreenPop is only called once for each agent for each alerting interaction. The method can return data that changes the default screen pop behavior.

If the Apex code triggers an exception, then the integration performs the default screen pop behavior. If no value is returned, then the integration suppresses the screen pop behavior.

Input properties

The following properties are included in the JSON data that is passed to the method.

Name Data type Description Notes
searchValue String Search value. Example values: email address (for chat and email interactions), phone number (for voice and SMS interactions).
interaction Object Data object that represents interaction data. For more information, see the data object format in Condensed conversation information.

Output properties

Important: Use only one of the following properties in the JSON data returned from the onScreenPop method.
Name Data type Description Notes
url String URL of a page in Salesforce.  Can be a standard Salesforce page, a Visualforce page, or a new record page with pre-populated data from an Architect flow.
searchValue String Value searched for in Salesforce records. 

Can be a case number, a phone number, a contact name, or other items. 

For more information, see the Softphone layout settings section in Screen pop in Genesys Cloud for Salesforce.

defaultScreenPop Boolean Performs a default screen pop (true) or does not perform a default screen pop (false).

For more information, see the Default screen pop behavior section in Screen pop in Genesys Cloud for Salesforce.

For more information, see Screen pop in Genesys Cloud for Salesforce.

Example

Important:
  • Define the Apex class as global so the code can be called by the integration.
  • If you implement more than one extension point (or interface), place them all in the same Apex file.
global class MyCTIExtensions implements purecloud.CTIExtension.ScreenPop {
    public String onScreenPop(String data) {
        // Example: Find a recent Case record by phone number. if not found, fall back to default screen pop behavior.
        Map<String, Object> screenPopData = (Map<String, Object>) JSON.deserializeUntyped(data);
        Map<String, Object> dataToReturn = new Map<String, Object>();
        String phoneNumber = (String) screenPopData.get('searchValue');
        if (String.isNotBlank(phoneNumber)) {
            List cases = [SELECT Id FROM Case WHERE ContactPhone =: phoneNumber ORDER BY LastModifiedDate DESC LIMIT 1];
            if (cases.size() > 0) {
                dataToReturn.put('url', cases.get(0).Id);
                return JSON.serialize(dataToReturn);
            }
        }
        dataToReturn.put('defaultScreenPop', true);
        return JSON.serialize(dataToReturn);
    }
}

For more information, see Extension points in Genesys Cloud for Salesforce.

For more information about the integration, see About Genesys Cloud for Salesforce.