I need to create a function to which I pass a list of documents ('transactions') as a parameter and calculates the accumulated 'balance' (getting previous balance and adding actual 'inflow' and 'outflow') and saves it in each document field 'balance'
The function must return the same updated list