String format for multi-value lookup columns in SharePoint

I recently had a question from a client around multi-value lookup columns and how to set them using a workflow.

Scenario

A list serves as the master list and has a look-up column that is linked to a second list, containing details for a chosen item. In the master list we want to show the title of the item. Easy enough, a SharePoint out-of-the-box capability. Now the tricky part is, that the details list, in turn, contains a look-up column that links to the master list. When an item in the master list is created or updated, the look-up column in the details list should be updated and the created/updated item(s) should be set through a workflow.

Solution

Look-up columns can be updated through a workflow like any other column in SharePoint. What makes it special is the format though. As any column of the type look-up (i.e. Person field) it requires a certain format, containing the linked item’s ID and the value you specified when configuring the look-up column. So, when you create the required string for the update, just follow these formats:

  • Update the field with a single item: {ITEM ID};#{ITEMVALUE}
  • Update the field with two items: {ITEM ID};#{ITEMVALUE};#{ITEM ID};#{ITEMVALUE}
  • Update the field with 3+ items: {ITEM ID};#{ITEMVALUE};#{ITEM ID};#{ITEMVALUE};#{ITEM ID};#{ITEMVALUE}

Tags: , , ,

No comments yet.

Leave a Reply