Welcome, @jeremi !!! And great to see you at the DPGA meeting!
@mtuchi and @jclark are our job/adaptor champions at OpenFn, but if it were up to me I’d write:
createGroup({ name: "HHH" }, state => {
const groupId = state.data.newId // or wherever this shows up from the server
return { ...state, groupId }
});
// assuming you have an array of people
each(
dataPath('people[*]'),
createIndividual({ name: dataValue("name") })
);
each(
dataPath('people[*]'),
addToGroup(
state => state.groupId,
dataValue('')
)
);
whether or not you use each, and no matter how the openSPP helper functions are designed, i’d skip manually adding state.data and state.references at the top, and (because I’m no JS-whiz) I’d shy away from the async stuff at the bottom. Let OpenFn handle the ordering for you.