OpenFn/lwala

Create Household in SF job: `TypeError: Unknown value type case_`

Closed this issue · 19 comments

Initial error: Create HH in SF job was failing due to missing HAWI_Enrollment_Date__c field in message (see run https://www.openfn.org/projects/pdbmj5/runs/raa4bn49).

After modifying the job to send No is HAWI status is missing instead of undefined (see recent job history ), there is a new error: TypeError: Unknown value type case_, see failed run: https://www.openfn.org/projects/pdbmj5/runs/rrkywzxy on same message)

Adaptor

language-salesforce

State

See LP for Lwala Salesforce Production

@ritazagoni I corrected the issue with the case_id. However seems like there is still a missing required field: https://www.openfn.org/projects/pdbmj5/runs/r89pe9z9

Maybe it is one of those undefined fields? Could you have a look please?

@lakhassane this error is telling us we're sending a No string instead of a date value.
JSON_PARSER_ERROR: Cannot deserialize instance of date from VALUE_STRING value No or request may be missing a required field at [line:1, column:264]

@ritazagoni see L40 in the run: https://www.openfn.org/projects/pdbmj5/runs/r89pe9z9

Updated to send instead of No.
@lakhassane
I think the issue now is that we're setting the value of date_modified as Enrollment_Date__c and HAWI_Enrollment_Date__c , which is a timestamp: see L39 of the run https://www.openfn.org/projects/pdbmj5/runs/rrky36kb. And it expects a date JSON_PARSER_ERROR: Cannot deserialize instance of date from VALUE_STRING value or request may be missing a required field at [line:1, column:293]

@ritazagoni we are returning the right date format but still same error: https://www.openfn.org/projects/pdbmj5/runs/06152040-b2a8-7e35-95de-3bae00485a89

Is there a sandbox that I can use locally to test instead of running on prod?

@lakhassane See LP for LwalaTest Salesforce Sandbox (Sept 2021)

If your job fails because the CHW cannot be found... you can hardcode this id for the CHW mappings when testing a030800001zQvnAAAS

@aleksa-krolls @ritazagoni date issue solve. The issue was we were sending empty string for date instead of null/undefined.

Hitting something new with missing externalIds https://www.openfn.org/projects/pdbmj5/runs/06152f89-b3c9-70d1-bacd-5fe4955807d0

@lakhassane We are supposed to set "Basic_Information.Record_Type" as the Name of Record Type but we're populating an empty string instead (see log L86) instead of Child (see message L84)

@ritazagoni it's because in the state there is no Child in it. How should we proceed?

@elias-ba cc @lakhassane
We are trying to get the value of Record-Type that is on L84 in the message:

relationship("RecordType", "Name", (state) => {
return dataValue("form.Person.Basic_Information.Record_Type")(state)
.toString()
.replace(/_/g, " ");
}),

However we don't manage to get that field value from state: see failed run: https://www.openfn.org/projects/pdbmj5/runs/0615ac0d-9c65-76f7-a4de-71fe3fa4dcc1

@elias-ba ping me with any questions!

Hey @ritazagoni, sorry to take this ticket so late, my day was a bit disrupted today and I'm trying to make up for it. So I read all of your comments in the issue. I don't know if I understood the problem well enough. Can we make a call tomorrow morning so that you clearly explain the problem to me? cc: @lakhassane

@ritazagoni I saw you added form.Person to the path at line 113.
However the previous path was correct so I removed it. The issue here is that when we access that path there is no value for Record_Type (but the path exists).

So what we need information on is what should we map for RecordType if there is no Record_Type. Undefined or something else?

See L249 in the message for empty Record_Type

@elias-ba the path is supposed to point to L84 in the message where we have "Record_Type": "Child" (form.Person.Basic_Information.Record_Type).

@elias-ba I get it know, we have multiple Person-s. Can you try and skip the Relationship creation part in the job if Record_Type is empty?

It might be a required field so it might not work, but we'll see it with testing.

Hey @ritazagoni I see that we're using language-salesforce@v2.4.0 in this job. Should we change it to language-salesforce@v2.7.1 as it's the newest version of the SF adaptor.

@ritazagoni and @lakhassane this is the error message I have: INVALID_FIELD: Foreign key external ID: not found for field Name in entity RecordType when I run the job. See this run: https://www.openfn.org/projects/pdbmj5/runs/0615d5fd-999a-709c-97aa-6280f8c977bb. Could you guys help me advance faster in this ?

@aleksa-krolls if you can help also !

@ritazagoni this last Person looks like an incomplete enrollment, which is why all the fields like Name and RT are blank... what does this look like in CommCare? Do you agree that this isn't a complete Person record? (Therefore should we remove this item from the array in the message... or add logic to not insert person if critical details like Name are not provided?)

@ritazagoni See my comment above. Please check it out and lmk how you think we should proceed so we can close this

Verified in CommCare, Person with caseId in question has all empty fields. Deleted it from request and reprocessed successfully https://www.openfn.org/projects/pdbmj5/runs/0616ec7d-ed7f-76e5-8eb5-eb47d39428fd