Skip to main content
About the Resource Center

Use the extension points to customize saving interaction logs

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.

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.

NameData typeDescriptionNotes
eventNameStringRepresents the state that triggered onSaveLogValues: interactionChanged, interactionDisconnected, interactionChangedAfterDisconnect, interactionACWCompleted, interactionRemoved, openCallLog, appDisconnected.
interactionObjectRepresents the state of the interaction.For more information, see the data object format in Condensed conversation information.
callLogObjectInteraction log data with changed values for the activity fields defined in Salesforce.Only provides portions of the integration log that changed.

Output parameters

NameData typeDescriptionNotes
{return value}StringID of the interaction log that was saved or updated.

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

Example

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.