Lwala's current CommCare-to-Salesforce workflows run on a real-time basis, with jobs that have message-filter triggers. To reduce its total number of OpenFn runs and improve system performance, it now wants to change its existing workflows to run on a cron, scheduled basis and to process records in bulk (rather than individual case updates).
Request
There is an existing job Referrals Upsert Service in SF V2 that is configured to process only 1 case record. It has 2 key operations:
Query Salesforce Service__c table to search for existing ServiceIds to use in the Referral Service mapping (for step 2)
Upsert Service__c
Please bulkify this job and the above three operations to (1) handle an input of an array of cases, and (2) to leverage the Salesforce bulk API.
Background
Lwala's current CommCare-to-Salesforce workflows run on a real-time basis, with jobs that have message-filter triggers. To reduce its total number of OpenFn runs and improve system performance, it now wants to change its existing workflows to run on a cron, scheduled basis and to process records in bulk (rather than individual case updates).
Request
There is an existing job Referrals Upsert Service in SF V2 that is configured to process only 1 case record. It has 2 key operations:
Service__c
table to search for existing ServiceIds to use in the Referral Service mapping (for step 2)Service__c
Please bulkify this job and the above three operations to (1) handle an input of an array of cases, and (2) to leverage the Salesforce bulk API.
Workflow diagram
See the workflow steps in the red box for the operations https://lucid.app/lucidchart/e3411bda-1f0e-492f-b35d-6baf2dd3972a/edit?invitationId=inv_218cd740-0c18-446b-b225-b327e581f1b8&page=pL9NzLAEAjkQ#
FYI - This is a really old job originally written by the client, so no mapping spec is available.
expression
⚠️ Please start work on the
bulk-testing
branch, and feel free to commit changes to this branch. ⚠️Existing job to bulkify: https://github.com/OpenFn/lwala/blob/bulk-testing/commcare-salesforce-jobs/Referrals-Upsert-Service_V2.js
The field-level mappings should be the same as the existing job.
state
Lwala Salesforce Sandbox (Bulk 2023)
output
There are a 2 items in the
objects
array of sample state.data. This should result in the same number ofService
records to upsert.These
Service
records will be child to relatedPerson
records created via job #90 .toggl
Use the
Lwala Bulk Workflows [2023] - 40 hrs
toggl project.