OpenFn / adaptors

The new home for OpenFn adaptors; re-usable connectors for the most common DPGs and DPI building blocks.
GNU General Public License v3.0
4 stars 8 forks source link

Salesforce: Issue with mapping and upserting a nested object using Salesforce adaptor #556

Open AishaHassen opened 1 month ago

AishaHassen commented 1 month ago

Mapping for an object using the Salesforce adaptor that has a relationship with another object(Openfn_Project__r) no longer works as per below:

'OpenFn_Project__r.Metrics_ID__c': 'id_value'

Getting the following error when doing the mapping like the above and using the upsert function from the salesforce adaptor

Upserting Deal__c with externalId Contract_ID__c : {
  Contract_ID__c: 'FCA2023',
  Start_Date__c: '2023-04-02T21:00:00.000Z',
  End_Date__c: '2023-06-29T21:00:00.000Z',
  Next_Steps__c: 'No',
  Asana_Link__c: 'https://app.asana.com/0/1204270101347732/1204277345786609',
  'OpenFn_Project__r.Metrics_ID__c': '4183'
}
[R/T] ✘ Failed step job-1 after 2.95s
[R/T] ✘ AdaptorError: No such column 'OpenFn_Project__r.Metrics_ID__c' on sobject of type Deal__c

I tried using both the bulk function(failed job code and job run using bulk function with dot operator for the mapping) and the upsert function([failed job code and job run using upsert function with dot operator for mapping).

The above method of mapping seems to be working in this project(checkout this blob)

Here is a successful job that is using the following format for mapping nested objects: OpenFn_Project__r: { Metrics_ID__c: 'id_value' }

  1. Is it a bug on the adaptor version? Can we modify the adaptor so that mapping with a dot operator is also acceptable?
  2. Is it an intended feature, if yes can we modify the documentations?
aleksa-krolls commented 1 month ago

thanks @AishaHassen - adding to backlog!

aleksa-krolls commented 1 month ago

To fix this: