AnsweredAssumed Answered

Database Query Filter using SOQL Query Results

Question asked by dbarrow.ninety10 on Sep 7, 2018
Latest reply on Sep 12, 2018 by dbarrow.ninety10

Hello! I am trying to build a process to load data from a home-grown CRM database (PostgreSQL) into Salesforce (mostly Contact data, but others as well). There are some issues with inconsistent data which cause  numerous documents to fail when doing the Salesforce operation; most of the documents succeed, but a too-high number fail.


Additionally, in a multi-branch process, failures in the first branch  are causing subsequent branches to not run.


What I'd like to do is filter the source database query based on a list of IDs I'm getting from Salesforce. For example, currently when doing an UPSERT on Salesforce Contact:


1. Pull Contact records using a query

2. Map source data to Salesforce XML with a Connector Call to get the Salesforce Account record ID using an External ID

3. Run  the Upsert


Pretty straightforward. All of the above works (except we get numerous records with errors). What I'd like to do is this:


1.Generate a list of all Salesforce record IDs using a simple Connector Operation and combine the returned documents into a single document (preferably a comma-separated list)

2. Pull Contact records using a query with an IN clause using the list of Salesforce record IDs already retrieved in Step 1

3. Map the source data (smae as above

4. Run the Upsert


This is my concept - if there is a better and/or easier way to do this, please point me in that direction.


Thanks in advance!