Note: This article applies to Genesys Cloud for Salesforce.

You can use the extension points to customize saving interaction logs 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.SaveLog interface. Define the Apex class as global so the code can be called by the integration.

purecloud.CTIExtension.SaveLog interface

Contains a method signature that you can define to customize saving logs in Genesys Cloud for Salesforce.

Usage

Use the method signature in the purecloud.CTIExtension.SaveLog interface to define how saving logs works.

onSaveLog method

Used to save interaction log information.

This method is called whenever the integration detects a change in the interaction log at certain interaction or user events. The method receives unsaved interaction log data for a task record.

If the method saves the data successfully, then return the ID of the record. If the method does not save the data, then return an empty string.

Note: The onSaveLog method does not support returning a null value.

Input properties

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

Name Data type Description Notes
eventName String Represents the state that triggered onSaveLog Values: interactionChanged, interactionDisconnected, interactionChangedAfterDisconnect, interactionACWCompleted, interactionRemoved, openCallLog, appDisconnected.
interaction Object Represents the state of the interaction. For more information, see the data object format in Condensed conversation information.
callLog Object Interaction log data with changed values for the activity fields defined in Salesforce. Only provides portions of the integration log that changed.

Output parameters

Name Data type Description Notes
{return value} String ID of the interaction log that was saved or updated.  

For more information, see Interaction logs and View and edit interaction logs.

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.SaveLog {
    public String onSaveLog(String data) {
        // Example: Save interaction log as Task record after interaction is disconnected.
        Map<String, Object> saveLogData = (Map<String, Object>) JSON.deserializeUntyped(data);
        Map<String, Object> interaction = ( Map<String, Object>) saveLogData.get('interaction');
        Map<String, Object> callLog = ( Map<String, Object>) saveLogData.get('callLog');
        Boolean isDisconnected = (Boolean) interaction.get('isDisconnected');
        String callLogId = '';
        if (isDisconnected) {
            Task t = (Task) JSON.deserialize(JSON.serialize(callLog), Task.class);
            upsert t;
            callLogId = t.Id;
        }
        return callLogId; 
    }
}

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

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