Supervisor Visit mapping logic
Closed this issue · 3 comments
Overview
We need to clean & re-format picklist values provided by CommCare before uploading to Salesforce. This logic needs to be applied in 2 jobs wherever the Salesforce field Supervisor_Visit__c
is referenced.
lwala/commcare-salesforce-jobs/Update-Person-in-SF-Production.js
Lines 1420 to 1424 in 642bf02
Request
Update Update-Person-in-SF-Production.js
and MOH513-Update-Household-in-SF-Production.js
to include the following mappings for wherever Supervisor_Visit__c
is referenced:
// commcare_input: salesforce_output
// "supervisor_visit": "Supervisor_Visit__c"
'community_health_nurse': 'Community Health Nurse'
'chw_supervisor': 'CHW Supervisor'
'chewschas': 'CHEWs/CHAs'
'other': 'Other'
'none': 'None'
Example
The below sample state from CommCare should output the value 'CHEWs/CHAs'
in Salesforce.
"supervisor_visit": "chewschas"
Resources
state.json
Test with Lwala Salesforce sandbox. See LP for creds.
Update-Person-in-SF-Production.js
test: Usesample_data/state_anc4.json
to test scenario whereSupervisor_Visit__c = 'None'
. Update the value"supervisor_visit": ______
to test the different combinations.MOH513-Update-Household-in-SF-Production.js
test: Usesample_data/state_HHsupervisor.json
adaptor
Use language-salesforce and make use of this LP's FakeAdaptor
for offline testing.
expression.js
Update Update-Person-in-SF-Production.js
Update MOH513-Update-Household-in-SF-Production.js
Toggl
Log your time to Lwala Cleanup 2020
@lakhassane Can you please add logic to handle for instances where supervisor_visit
is null or undefined? If so, it should return a null value.
@aleksa-krolls added the logic and made a test.
First screen shows an undefined supervisor_visit
and second one shows the ouput where it is set to null
Closing this as it is solved.