Salesforce Platform Event
Has anyone connected a Platform Event listener for Salesforce?
We are using the listener trigger but am getting this error:
System.SObjectException: Invalid field Id
Class.integrator_da.
Class.integrator_da.
Class.integrator_da.
Class.
Class.rflib_TriggerManager.
Class.rflib_TriggerManager.
Class.rflib_TriggerManager.
Trigger.
Also, how would we program the listener in Celigo for the Platform Event?
Best,
TJ
Comments
Hi Limebox Consultant
Will it be possible for you to share the "ProvisionFulfillmentRequest" trigger? there is something wrong with it, would like to look into it.
Thanks,
Hello Muneswara,
Thank you for replying. Here is the code from the client (they created it):
public inherited sharing class CeligoRealTimeExportTriggerHandler implements rflib_TriggerHandler {CeligoRealTimeExportTriggerHandler.class.getName());
_e capturedRecord = (Provision_Fulfillment_Request__e) args.newRecords.get(0);
getKeyPrefix();
RealTimeExportResult res = integrator_da.RealTimeExporter.processExport();
TriggerManager.Args args, Integer numInvocation) {
rflib_Logger logger = rflib_LoggerUtil.getFactory()
.createLogger(
public void run(rflib_TriggerManager.Args args) {
logger.info('Exporting records to Celigo');
logger.info('Celigo Real Time Export Args: {0}', new List<Object>{ args });
Provision_Fulfillment_Request_
// get prefix for this sObjectType
string prefix = args.objectType.getDescribe().
logger.info('Prefix: {0}', new List<Object>{ prefix });
// does an Id exist already? (Oh, Salesforce doesn't like us doing this. Error.)
logger.info('Real Id?: {0}', new List<Object>{ capturedRecord.Id });
// Try setting with a test ID of all 0s, just to see what happens.
capturedRecord.Id = prefix + '0'.repeat(12);
logger.info('Mock Id: {0}', new List<Object>{ capturedRecord.Id });
integrator_da.
logger.info('Celigo Real Time Export Result: {0}', new List<Object>{ res });
}
public void onConsecutiveRun(rflib_
this.run(args);
}
}
Please note, they tried adding the "Id" parameter as a "hack"... but it didn't work.
Hi Limebox Consultant,
This is the first time we see a Salesforce Platform event trigger, I did research on it. regarding your code "capturedRecord" will not have an id. actually, it's not a record it's a request input. I think even though we add a parameter for Id, most probably it may not work, because based on trigger context we will run soql query internally. platform event doesn't support soql query. it could one of the reasons for the exception for Id in the Salesforce package.
Can you explain, how the process works in a client account?
1) From where, Provision_Fulfillment_Request__e will be invoked?
2) In Provision_Fulfillment_Request__e trigger what exactly the client is expecting to send the data to integrator.io. What exactly we are doing here?
Another option that we can do is once we have the list sObject we can format it into payload (body) and in Apex class itself we can use HTTP request to send the data to IO webhook. this will solve the problem.
But IMO, I think a better raise support ticket, will be useful from our end for better tracking purposes for these types of requests, we need more investigation on this and we will provide a better solution.
The webhook option is what I was thinking would end up being the best tool.
We do have a ticket created and are waiting for the reply, thank you for that.
Just wanted to see if anyone has used Platform Events because this is the second request we have received for that internal object.
Best,
TJ
We want to use platform events.
Are there templates avaible or examples from others?
Please sign in to leave a comment.