Q3 2022 Update HH Name in CommCare
Metadata
- Name: Q3 2022 Update HH Name in CommCare
- Adaptor:
@openfn/language-commcare
- Adaptor Version:
v1.4.1
- Created about 3 years ago
- Updated 8 months ago
- Score: 93 (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',
});