Question

I have a workflow that automatically updates the value of a multi-valued field in an item. This workflow is working as expected. BUT, when that field/column of an item has a value already, the current value gets replaced when i update its value.... What i merely want is adding an item to that multi-value column/field without replacing its current value...

To make things specific, Column name: Attached Files (Multi-valued, Links to the Source Name of the File) Lets say this specific item has file named "file1.doc" value to Attached Files column, Then i want to update this column with a new document named file2.doc... i want the result of Attached File column for this item to be links to "file1.doc" and "file.doc"

EDIT: Thanks andrey for your input. Regarding the getting of previous data, im having trouble on this one... On its simplest form, I tried to set the value of Attached Files column to its own value before i add the current item value for debugging purposes coz if i directly jump to "current + new item" addition i got an error that's why i made it simple first but still i got an error... How can i add the new item to the current value if setting it to its current value gives me an error already? Im expecting that this would just be fine since i'm merely overwriting the current value with its current value :). Am i right?

Thank you!

Was it helpful?

Solution

Usually if you want to add value into multivalue field in SharePoint Designer, you should set value to the existing value plus the new value.

This involves conversion of the field value to string and then from string, so you must be aware of how sharepoint stores multivalue column internally, which is something like this:

id1;#value1;#id2;#value2;#id3;#value3

(so the separator is ;#, and each item is represented by id and value)

So you need to provide your own value after the existing value. Here is how you can do it in SharePoint Designer:

enter image description here

Instead of ;<put your new value here> you should use for example something like this:

;#5;#file5

I used this approach several times in real world projects and it works quite well.

P.S. Please don't forget to check if the current value is empty, in this case obviously you should use your current code.

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top