title: Sitecore set multi reference field value programmatically
body: <p>How to set a multi-reference field value programmatically if I have collection of items/ids?</p>
  
  <p>E.g. Build following raw value "{guid1}|{guid2}|{guid3}..."</p>
  
  <hr>
  
  <p>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.</p>
  
  <p>E.g. Custom list with rule "where [is odd] orderby child desc" build for each Parent and set to field "Odd"</p>
  
  <ul>
  <li>Parent1 -> Parent1["Odd"] = 5<br>
  <ul>
  <li>2</li>
  <li>5</li>
  </ul></li>
  <li>Parent2 -> Parent2["Odd"] = 3,1
  <ul>
  <li>1</li>
  <li>2</li>
  <li>3</li>
  </ul></li>
  </ul>