- My goal: Query 10k records from DB, group in batches of 100 for API batch insert.
- Issue: How do I group all records in ‘one batch’, so I can aggregate these before inserting them in HubSpot via API call? I would expect to either have access to an array
valuesor to have some kind of aggregation node that I can use to combine multiple values. - Steps I've taken to troubleshoot: I can only access a single ‘value’ in a function
- Additional info: Cloud
You can use a js codeblock to create batches and then loop with the hubspot query:
function chunkArray(array, size = 100) {
return array.reduce((acc, _, index) => {
if (index % size === 0) {
acc.push(array.slice(index, index + size));
}
return acc;
}, [] );
}

