How to set a multi-reference field value programmatically if I have collection of items/ids?
E.g. Build following raw value "{guid1}|{guid2}|{guid3}..."
In my specific case I need to import a tree of items and on one level a parent was using children as repository and it also had a multi reference list to a subset of the children based on some criteria. I wanted to build a flexible list based on ordering or filtering and then set value of parent without making code specific to a list type - parent field can be any list.
E.g. Custom list with rule "where [is odd] orderby child desc" build for each Parent and set to field "Odd"
- Parent1 -> Parent1["Odd"] = 5
- 2
- 5
- Parent2 -> Parent2["Odd"] = 3,1
- 1
- 2
- 3