I ran into another request recently which tied closely to a solution that I previously built a blogged about: Utilizing new related items column via workflow. In that solution we had a custom list tracking project deliverable information and a document library used to stored the final documents. When final deliverable documents were uploaded, the related deliverable in the custom list was selected, and a workflow ran in which the related items field on the tracker was updated for the selected deliverable. That means as documents were added to the library the related items in the list would be updated to align the list and the library.
Due to some view limitations when looking at the items we wanted to move to a multi-value lookup column instead of a related items column. The same scenario exists in which we want to show the deliverable documents in the deliverable list and there can be multiple documents that apply to single deliverable.
- This post will outline the format and the steps to update a multi-value column once via workflow.
- Part 2 will outline how to loop through and then append both the current value of the lookup column and the new value.
In this scenario:
- Deliverable Documents is the multi-value lookup column in the Deliverable Tracker custom list
- Related Deliverable is the lookup column on the Deliverable Documents library
Format - Single Value
When setting a single value in a lookup column you want to use the ID of the piece of content that should be in the lookup column. This ID should be in the integer format.
In this screenshot we are setting the Deliverable Documents field (lookup column!) to the Current Item:ID where the ID of the Deliverable Tracker matches the Related Deliverable Lookup Id (as Integer).
Format - Multi-Value
When setting a multi-value lookup column you want to use";#;#" as the delimiter between the IDs of the pieces of content that should be in the lookup column.
For example: 1;#;#2;#;#3;#;#4
Another major note: This update action needs to be ran using a SharePoint 2010 Workflow. The way I prefer to do this is build my primary workflow in using a SharePoint 2013 template and calling the 2010 template inside of it.
In this screenshot we are setting the Deliverable Documents field to [%Current Item:ID%];#;#[Deliverable Documents:ID%] where the ID of the Deliverable Tracker matches the Related Deliverable Lookup Id (as Integer). This passes 2 values to the lookup field. The first is the Current Item ID and the second is an ID of a document that I want to include on all items.
We have one issue with this scenario. If we want to add another value to the multi-value lookup column and not replace the current values, we will need to gather the current value and append the new ID. I will outline how to do this in Part 2!