Configuring Two-Way Real-Time Sync for Custom Objects
When you configure two-way real-time sync support for custom objects between Service Board and Salesforce, configured process builders for the Create and Update events cannot be used on the Salesforce side. The reason is that when Create or Update events for custom objects are synced to Salesforce from Service Board, platform events are created for the same events and synced back to Service Board, which causes an echo issue. To avoid this scenario, you must configure Apex triggers to sync Create and Update events for custom objects from Salesforce to Service Board.
To configure two-way real-time sync for custom objects:
1. In Salesforce, create the SB_PBSecurityUtils and SB_Custom_IntegrationHelper Apex classes if needed. For more information, see Configuring Salesforce for Service Board-to-Salesforce Real-Time Sync for Custom Objects.
2. Create triggers for the Create and Update events. The following examples show triggers for a custom object with the API name Custom_Object__c.
Create Event
trigger SB_Custom_Object_Create_Trigger on Custom_Object__c (after insert) {
Map<string,String> mapSettings = new Map<String,String>();
mapSettings = (new SVMXC.COMM_Utils_ManageSettings()).SVMX_getGlobalSettingList(new List<String>{'DCON007_SET001', 'DCON007_SET003'});
system.debug(loggingLevel.WARN, 'mapSettings DCON007 = ' + mapSettings);

Boolean isServiceBoardEnabled = false;
if(mapSettings.containsKey('DCON007_SET001') && mapSettings.get('DCON007_SET001') != null) {
isServiceBoardEnabled = Boolean.valueOf(mapSettings.get('DCON007_SET001'));
}

if(isServiceBoardEnabled){
SB_Custom_IntegrationHelper peHelper = new SB_Custom_IntegrationHelper();
peHelper.preparePlatformEvent('create', 'Custom_Object__c', trigger.newMap);
}
}
Update Event
trigger SB_Custom_Object_Update_Trigger on Custom_Object__c (after update) {
Map<string,String> mapSettings = new Map<String,String>();
mapSettings = (new SVMXC.COMM_Utils_ManageSettings()).SVMX_getGlobalSettingList(new List<String>{'DCON007_SET001', 'DCON007_SET003'});
system.debug(loggingLevel.WARN, 'mapSettings DCON007 = ' + mapSettings);

Boolean isServiceBoardEnabled = false;
if(mapSettings.containsKey('DCON007_SET001') && mapSettings.get('DCON007_SET001') != null) {
isServiceBoardEnabled = Boolean.valueOf(mapSettings.get('DCON007_SET001'));
}

if(isServiceBoardEnabled){
SB_Custom_IntegrationHelper peHelper = new SB_Custom_IntegrationHelper();
peHelper.preparePlatformEvent('update', 'Custom_Object__c', trigger.newMap);
}
}
For more information:
Was this helpful?