Closed aleksa-krolls closed 4 years ago
@aleksa-krolls , do we want the first item in the array, or the item with the most recent date?
@taylordowns2000 good q. Let's do with the most recent date!
@taylordowns2000 Now hitting this error. Maybe because we don't always receive a transition
from Primero. Can we handle for the scenario where transition
may not be present... in this case return null.
TypeError [Error]: Cannot read property '0' of undefined
Please submit change as a pull request. I've comment out this change for the time being because users are testing and I don't want them to hit this error.
https://github.com/OpenFn/unicef-cambodia/blob/7cc95c83f608c926fcb4fd5f2d4e8a72b4461bbb/jobs/f1-j2-casesToOscar.js#L155-L157
Please (1) comment this out and (2) insert the below mapping (not sure if the below is correct - see below payload):
reason_for_referral : transitions[0].note
Primero sends us this payload where there can be multiple
transition
objects - use thenote
from the first one (but build in handling to prepare for if the transitions array is empty or non existent).