On submitting a form, I perform two actions:
- Transform a list of selected items from a multi-select input into an array of objects.
- Use that array of objects for a bulk insert into Supabase.
I wrote this JS code in the formula for Step 1:
var transformArray = function(array, initiativeId) {
return array.map(function(value) {
return {
initiative_id: parseInt(initiativeId),
resource_id: value
};
});
};
return transformArray(variables['ID-currentSelection'], globalContext.pageParameters['initiative_id']);
I can see that this returns an array of objects.
For Step 2, however, when I try to access the result variable of Action 1, it says the result is undefined.
What am I missing here?