function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gtuerk_greensaasgtuerk_greensaas 

Exposing data with Platform Events without code

I'm doing my best to support the integration of Salesforce with a Billing Platform without any code in SFDC.  I've pointed the client to all the REST API resources they need to do basic CRUD operations and they're happy with that.  Now, I need SFDC to push a message out to a middleware service and I'm evaluating options.  Many moons ago, I would have had only one resource to choose from - an Outbound Message.  Today, with Platform Events and the Streaming API I have a couple more options.  The problem I'm facing is that the triggering event resides on one object, not directly related to the object structure that needs to be integrated.  I'm forced either to pollute my data model to support formula field-based inclusions in the payload or to write custom code to traverse the data model and include it on a platform event.  

I'm sure with Integration Cloud coming, the product team will likely point me that direction, but for now...  Here's the example:

Custom Object A - this is the triggering object.  When this object moves to 'Accepted', I wish to get to a related object via the following traverse.  Custom Object B looks up Custom Object A and is Detail in a master/detail relationship with Custom Object C.  Custom Object C looks up Custom Object D.  I want to pass the ID from Custom Object D in the platform event, which will be initiated from a process builder on Custom Object A.

the query in a pushTopic would be something akin to:  select id, name, (select Id, name, custom_object_c__r.custom_object_d__r.Id from custom_object_b__r) from custom_object_a__c where status__c = 'Accepted'.  I could cast the return of the related records in custom object b.

With outbound messages, I could generate a message with the Id of Custom Object A but would have to tell the middleware team to query and conditionally route the message.  

As a fall-back, I can write a trigger on Custom Object A and do the traverse and conditional spawn of the platform event.  But, again, I'd like to avoid writing code.  Any clever ideas?