Saltar al contenido principal
Esta página no tiene versión en español, así que te la mostramos en inglés.

Q3 2022 Update HH Name in CommCare

This job was provided by an OpenFn.org user via the job library API.

Metadata​

  • Name: Q3 2022 Update HH Name in CommCare
  • Adaptor: @openfn/language-commcare
  • Adaptor Version: v1.4.1
  • Created about 5 years ago
  • Updated over 1 year ago
  • Score: 0 (an indicator of how useful this job may be)

Key Functions​

map, submitXls, Array

Expression​

// Update CommCare case
fn(state => {
const { Notification } = state.data.Envelope.Body.notifications;

const Notifications = Array.isArray(Notification)
? Notification
: [Notification];

const notifications = Notifications.map(notification => {
console.log(
`Mapping HH code to CommCare: `,
notification.sObject.Household_Code_Autonumber__c
);
return {
case_id: notification.sObject.Commcare_Code__c,
name: notification.sObject.Household_Code_Autonumber__c,
};
});

return { ...state, notifications };
});

submitXls(state => state.notifications, {
case_type: 'Household',
search_field: 'case_id',
search_column: 'case_id',
name_column: 'name',
create_new_cases: 'off',
});