Stackable List Order

Hi, I am using the Stackable List element and I want to run a loop in a workflow that updates the ‘order’ field of each object to match their index number in the list, Basically logging the order of the objects in the list after they have been re-arranged.

I’m not seeing a way of setting the objects in the list as an array. Whats the best method to update the order of the objects in the database to match their index in the list?

How I solved this is by replacing all elements of the array using some JavaScript to update the “order_no” key with the actual position of the list.
The updated List is provided as Event Output in the Stackable Element.

Here is the setup and code:

Screenshot 2024-02-13 at 12.40.34

var updated_list = event?.[‘updatedList’];

for (let i = 0; i < updated_list.length; i++) {
updated_list[i].order_no = i;
}
return updated_list

2 Likes