Closed daissatou2 closed 3 years ago
@aleksa-krolls, @daissatou2 and I started working on this issue and below is the update:
check_the_services_that_client_was_referred_to
field of the CommCare Data.ids for the option values
for the following questions :
Once we have access to this list, then we can send the data as shown in this field.
Note that currently, we are defaulting them to false
if value is blank/undefined:
field('TB_Screening_GRS_Staff__c', state =>
state.helperFunctions.checked(
'tb_screening_treatment_adherence',
dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state)
)
),
In this example, state.helperFunctions.checked
function will return true
or false
based on whether tb_screening_treatment_adherence
is part of the space separated string(form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to)
from the CommCare Data.
Our assumption is that Salesforce will then be able to mark them as checked/unchecked
based on whether we sent true
or false
. With this approach, we can also easily tweak
the values expected by Salesforce to mark the fields as checked/unchecked
.
Kindly advise.
Thanks.
@aleksa-krolls, @daissatou2 and I started working on this issue and below is the update:
- The job has been updated with a function to map checked options to true or false based on whether they are present in the respective
check_the_services_that_client_was_referred_to
field of the CommCare Data.- For this solution to work, we need an exhaustive list of option values for each of the check boxes. If you have access to the CommCare form, kindly copy and share the
ids for the option values
for the following questions :
referral_services.art_support_services.check_the_services_that_client_was_referred_to
- art_initiationenrollment
- etc.
referral_services.child_protection_support_services.check_the_services_that_client_was_referred_to
- post_violence_care_medical_legal_counseling
- etc.
referral_services.hiv_support__care.check_the_services_that_client_was_referred_to
- tb_screening_treatment_adherence
- etc.
referral_services.legal_services.check_the_services_that_client_was_referred_to
- birth_certificate
- etc.
referral_services.mental_health_services.mental_health_select_services
- iptg_to_health_facility
- etc.
referral_services.other_srhr_services.check_the_services_that_client_was_referred_to
- sti_screening_diagnosis_treatment
- etc.
Once we have access to this list, then we can send the data as shown in this field.
Note that currently, we are defaulting them to
false
if value is blank/undefined:field('TB_Screening_GRS_Staff__c', state => state.helperFunctions.checked( 'tb_screening_treatment_adherence', dataValue('form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to')(state) ) ),
In this example,
state.helperFunctions.checked
function will returntrue
orfalse
based on whethertb_screening_treatment_adherence
is part of thespace separated string(form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to)
from the CommCare Data.Our assumption is that Salesforce will then be able to mark them as
checked/unchecked
based on whether we senttrue
orfalse
. With this approach, we can also easilytweak
the values expected by Salesforce to mark the fields aschecked/unchecked
.Kindly advise.
Thanks.
@aleksa-krolls , for me to make progress on this issue, I need the things I asked for in this comment.
@aleksa-krolls , @daissatou2 and I updated the mappings for this job. We are getting the error below, and once @daissatou2 fixes it, we should be good to test:
REQUIRED_FIELD_MISSING: Required fields are missing: [Business_Unit_Site__c]
@daissatou2 note the below updates:
I have updated the upsertServiceReferral
job to handle other
fields correctly as shown here.
I have also updated the upsertServiceReferralFollowup, as per mapping specs. Note that the mappings are not in-sync with the sample data(so kindly check and advise). You would probably need to open a new issue for this so we can track it separately.
Thanks.
@chaiwa-berian The Service Referral form is returning false even if the item is present in the message. Example: This run is assigning false to VMMC_GRS_Staff__c : https://www.openfn.org/projects/pd3yk4/runs/r89848wb
But if you look in the message, that field was checked by the user: form.referral_services.hiv_support__care.check_the_services_that_client_was_referred_to
Describe the bug
Upsert Service Referral Job isn't properly mapping the fields highlighted in green in the mapping sheet. Each option for the CommCare form questions map to a separate SF field. If the option is selected, check the box for the corresponding SF field.
To Reproduce
expression.js
Link to the job itself in Github: https://github.com/OpenFn/grassroot-soccer/blob/master/jobs/upsertServiceReferral.js
state.json
https://www.openfn.org/projects/pd3yk4/messages/mmq3kj8b
Expected behavior
Please make sure each CommCare choice for the green rows, are mapped to the proper field in Salesforce: Ex. The choices for the CommCare question
/referral_services/hiv_support__care/check_the_services_that_client_was_referred_to
are:HIV Testing Services
TB Screening, Treatment, Adherence Support
VMMC
Post Exposure Prophylaxis
PrEP
Other
These are checkboxes and more than one can be selected at a time. If
PrEP
is what's selected in the state file, map toPrEP_GRS_Staff__c
in Salesforce which is also a checkbox.