Adding an item into an array (list)

Hello guys,

we are struggling with adding a new item into an array. We have a process where user is presented with a few options (each option each line and also a separate document in Firestore Database). If that user chooses one of them, we have an array of user_uid for each document and we need to add the current user’s uid as a new item into that array. But however we are unable to find a working solution.

Scheme: Each document has an array where we wanna store user’s uids. Each document’s field name represents a title of an option. By clicking on the option we want to add a field into an array of users.

Thank you very much.

Try this:
INSERT_ITEM_AT(data.routes, 100, {“user_uid”: appVars.uid})

You need to initialize the array to 0 items. Just do a Set Variable node to an empty value.

Tx a ton for your prompt help. I replaced the formula with this and it worked: (sorry I deleted the original question by mistake)

!IS_NULLY(data.SingleUserQuery.fields.contentLikedByUsers.arrayValue.values) ? INSERT_ITEMS_AT(data.SingleUserQuery.fields.contentLikedByUsers.arrayValue.values, 0, [{“stringValue”: appVars.userEmail}]) : INSERT_ITEMS_AT([], 0, [{“stringValue”: appVars.userEmail}])