OpenFn / lwala

2 stars 3 forks source link

Review PR for `language-salesforce` #81

Closed ritazagoni closed 2 years ago

ritazagoni commented 2 years ago

When bulk upsert-ing in Salesforce, we need to use a "fieldName": x.path mapping object. For one of the fields that needs to be upserted, this requires a query to Salesforce:

"fieldName": query(`select Id from Contact where CommCare_ID_c = x.id`

The current query function in language-salesforce adds the result object to the state.references array. For the bulk upsert, we need to be able to access and map the result object directly.

The new directQuery function returns the result object directly, rather than adding in to state.references. Tested locally.

Please review the PR, and leave any suggestion for tests, function name etc.

Thanks!