Closed ritazagoni closed 2 years ago
@taylordowns2000 this is ready to pick up. Please connect with @ritazagoni to evaluate whether this is worthy as a language-pack helper function.
@ritazagoni , @aleksa-krolls , I think this is sorted — see Slack thread and note the new adaptor version required when it's released. (I'll update the thread there.) My work is currently on 75_empty_strings
and I'm opening a PR shortly.
Background
Lwala wants to update Salesforce cases based on CommCare data. In some instances, CommCare sends us empty strings (when no data is available for a field), but there are values already available in Salesforce. Lwala doesn't want to overwrite those Salesforce values with empty strings.
In case the value from CommCare is an empty string, we want to map 'undefined' to SF (which won't overwrite existing data). To achieve this, we could use a helper function like such:
However, with this solution we would need update every step of mapping in the job, which currently looks like this:
field('Birth_Certificate__c',dataValue('properties.birth_certificate'))
to use the helper function, which would look like this:
The request
undefined
value` before sending to Salesforce)dataValueUndefined()
function inlanguage-salesforce
which returnsundefined
in case the source data value is""
.dataValueUndefined
function to be added tolanguage-common
as well.The current job
https://github.com/OpenFn/lwala/blob/master/commcare-salesforce-jobs/test_jobs/TEST-Upsert-Person-Case-Update.js
State
Sample data: https://github.com/OpenFn/lwala/blob/master/sample_data/upsert-person-case-update-sample.json (This sample has the example value of
Birth_Certificate__c'
filled in Salesforce, while the value from CommCare is "" ).Config
See
LP
Lwala Salesfoce Sandbox (MOTG - Implementation user)
Adaptor
language-salesforce