Closed aleksa-krolls closed 3 years ago
@chaiwa-berian can you take this on today or Monday?
@aleksa-krolls, @daissatou2 , for some messages (https://www.openfn.org/projects/pd3yk4/messages/mk5a66v8 - the message which produced the undefined
above) it appears that form.question1
is an array of objects. For other messages (https://www.openfn.org/projects/pd3yk4/messages/mgk5gdvb) and for the mapping provided on the specifications spreadsheet, it's a single object.
Questions from me/ @chaiwa-berian :
question1
to be an array? (I see two different participants in that array.)question1
objects:question1
object:@taylordowns2000 @chaiwa-berian Thanks for flagging as we hadn't seen a submission with multiple items in the array yet. It looks like this CommCare form allows users to register 1 or multiple participants. Therefore question1
is like a repeat group, and we should register 1 Participant for each
item in the question1:[...]
.
Can you please adjust the job to handle this potential array of participants accordingly? Thanks! cc @daissatou2
@chaiwa-berian please work on this to handle the array. See my comment above.
Ah! OK, I think we've seen this before... didn't we "enforceArray" for some other client? Where's the job library when you need it? @aleksa-krolls , @lakhassane , do you remember where we did this before?
Yeah we did in some other jobs.
Look for something like
Array.isArray(...)
@aleksa-krolls This is fixed, see run here.
@chaiwa-berian We had to update the path to @case_id
based on state. The job is now failing with a type error? See here: https://www.openfn.org/projects/pd3yk4/runs/rd78rpzp
Why? Is it maybe because of the @
character?
State to use: https://www.openfn.org/projects/pd3yk4/messages/mn575657
Expression: jobs/2.d.upsertRegisterParticipant.js
If you have questions, let @daissatou2 know and you all can jump on a call.
@aleksa-krolls Yes, the merge
is creating another field called case_id
which we use in subsequent field
operations like here field('Participant_Identification_Number_PID__c', dataValue('case_id')),
. So that caused the error.
@aleksa-krolls , @daissatou2 and I fixed this!
Background, context, and business value
See issue #1 for original specs. See this run where
First_Name__c
,Surname__c
,Sex__c
and other identifying fields are returningundefined
... can you check the job and mappings to verify? https://www.openfn.org/projects/pd3yk4/runs/r7xrk749expression
https://github.com/OpenFn/grassroot-soccer/blob/master/jobs/2.d.upsertRegisterParticipant.js
state
https://www.openfn.org/projects/pd3yk4/runs/r7xrk749 Please feel free to re-run on prod