Forum Discussion

omair's avatar
omair
Contributor
8 years ago

Salesforce Read Snap returns multiple documents - one per result

I was doing some testing of a basic pipeline involving a Mapper → Salesforce Read Snap → Mapper and found that the Salesforce Read snap returns multiple documents, one per returned result. Is that expected behavior? As my pipeline output, I need to return the number of results and an array with the Salesforce object ids of the returned objects. I’ve found that to be able to retrieve this data I need to use add a Group By N snap (group size= 0) before my Mapper snap to merge the results into a single document. This seems a bit odd to me: I would have expected a single document containing a JSON array with all the results…

  • j_angelevski's avatar
    j_angelevski
    Contributor III

    Hi Manzoor ,

    You can use the following expression to replace the NULL values with blank in the entity object, assuming it is a flat object.

    $entity.mapValues(val => val == null ? "" : val)

    This will simply iterate over each value in the entity object, and check if the value is null, if it is, it will return an empty string otherwise it will return the original value.