How to add value of multi-value field

hello guys,

I have a multi-value field of type record-selector
I wanna have a workflow to add a new record to the field

any idea how to do that ?
I tried an expression to target the field and the expression just the ID but it overrides the previous data on that field !!

To a workflow, multi value record fields are presented as an array so you can operate over them using the standard list manipilation functions.

For your case, to add a new value use push(array, item, ...items).

Here is an example I quickly threw together:

The first expression is push(record.values.toppings ?? [], "chocolate chip")
and the second one push(record.values.toppings, "sugar", "sprinkles").

You can add multiple items to the array using the same push.

Note the first expression where I used record.values.toppings ?? []; this is needed as in my case the array could be non-existent in case I haven’t added anything to it.
If your field is required or you’re certain it will be populated you can omit the ?? [] bit, else keep it.

1 Like

@tjerman thank you a million times

I tried your solution and it works for strings/number
however, it doesn’t work for the record selector !!
can you share an example for record selector type ?

Works fine for me; are you getting errors?
Make sure that the ID is quoted, so "271571889187614725" and not 271571889187614725.

Screenshot from 2022-02-21 11-47-21

@tjerman OK works fine now
I’m trying to push the record not the recordID, that was the issue

1 Like