Salesforce Realtime Listener to HTTPS API transformation

Hello -

I am using a Salesforce Realtime Listener to update our internal systems when changes occur in Salesforce. My flow is:

Because of the limitations of our internal API, I have to post the entire updated Customer object back to our API. What I was thinking was some sort of Results Mapping on the Lookup where I map the values from Salesforce onto the output from the lookup and pass that along to the update step.

Any suggestions on how best to achieve this? I was thinking some sort of postResponseMap Script to “flip” the output to be the Lookup data, updated with the values from Salesforce.

Thanks in advance!

I was able to answer my own question. I created a postResponseMap JavaScript function that allows me to do the object merge.

function postResponseMap(options) {
  var salesforceData = options.postResponseMapData[0]; // The data from Salesforce trigger
  var lookupResult = options.postResponseMapData[0].lookupResult; // Array from the API lookup

  var customerObject = lookupResult;

  // add field mappings as needed
  // ...

  return customerObject;
}


1 Like

One thing you may want to consider is a branch after your lookup step. I do this a lot and will have one branch as an “Update” and one branch as a “Create”. This way I can make sure to create when appropriate or update when appropriate.

1 Like