I am trying to confirm that the approach I'm taking is officially supported and documented by Celigo.
I'm using a trigger handler in Salesforce to filter my records before calling integrator_da__.RealTimeExporter.processExport(). However, I am sending the following parameters:
recordList = a Salesforce list of sObjects whose type match the type of the Celigo Listener
flowHandles = a Salesforce list of strings with the appropriate (ie mapped to the specific Celigo Listener(s) needed) GUID value(s) from the Real Time Sync records in Salesforce
connectorId = a manually set value by a Salesforce admin on the appropriate Real Time Sync records
So, my call now looks like this: integrator_da__.RealTimeExporter.processExport(recordList, flowHandles, connectorId)
This is working well for me and allows me to truly filter the list of records that the Listener is receiving. I am asking for official documentation because the only reference I found to this was in a single community post. Thank you @jrmiedenis for sharing your solution in the community! It is the only reason I was able to get this working.
However, in two posts, there are references that processExport() either takes 0 parameters or 1 parameter. If this design is not officially supported or documented, I'd like some guidance on how to reliably only deliver records whose value has changed to the Listener. In Celigo, the filtering only allows for current value evaluation. My use case, though, is that we only want an action to be triggered when a record previously “in compliance” changes to “out of compliance.”
For reference, here are the relevant snippets of my code
Trigger
trigger CaseTrigger on Case (after update) {
if(Trigger.isUpdate) {
CaseTriggerHandler.afterUpdate(Trigger.oldMap, Trigger.newMap);
}
}
TriggerHandler
public with sharing class CaseTriggerHandler { public static void afterUpdate(Map oldRecords, Map newRecords) { Map outOfComplianceRecords = new Map(); for (Id recordId : newRecords.keySet()) { if(newRecords.get(recordId).Out_of_Compliance__c && !oldRecords.get(recordId).Out_of_Compliance__c) { outOfComplianceRecords.put(recordId,newRecords.get(recordId)); } }
if(outOfComplianceRecords.isEmpty()) { System.debug('No out of compliance Cases found.'); return; } else { System.debug('Out of compliance Cases found: ' + outOfComplianceRecords.keySet()); celigoTrigger(outOfComplianceRecords); } } public static void celigoTrigger(Map<Id,Case> outOfComplianceRecords) { /* Real_Time_Sync__c records are created by Celigo when a Listener connection is created. These records reflect the definition of the Listener in Celigo and enables us to manage the filtering entirely and send a curated set of records to the webhook. */ // Salesforce admin will manually set Connector Id values on Real_Time_Sync__c record String connectorId = 'Case_Listener_Id'; List<integrator_da__Real_Time_Sync__c> celigoSyncList = [SELECT Id, integrator_da__GUID__c, integrator_da__Connector_Id__c FROM integrator_da__Real_Time_Sync__c WHERE integrator_da__Connector_Id__c = :connectorId]; // GUID values below are set by Celigo upon creation of Real_Time_Sync__c record List<String> flowHandles = new List<String>(); for (integrator_da__Real_Time_Sync__c sync : celigoSyncList) { flowHandles.add(sync.integrator_da__GUID__c); } // Making this callout sends our filtered list of records to the appropriate Listener in Celigo integrator_da__.RealTimeExportResult res = integrator_da__.RealTimeExporter.processExport(outOfComplianceRecords.values(), flowHandles, connectorId); }
}