cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

How Can I Update a Multi-value Lookup Column

Jump to solution

I've seen this question asked in different forms, but not necessarily with this configuration and I can't seem to figure this out.

 

I have 2 lists (List A and List B)- each have a multi-value lookup column that point to the same List C.

 

I cannot figure out how to use a workflow to lookup data in List A from the lookup column (List C) and then update List B's lookup column (also list C) with the same values.

 

As far as I can tell so far it involves building a string out of a set variable action that looks up the values from the lookup column in List A, but I cannot seem to get this working.  Any suggestions?

Labels: (2)
Tags (1)
Reply
48 Replies
Workflow Hero

Re: How Can I Update a Multi-value Lookup Column

Jump to solution

If I've well understood what you are trying to do is to copy the value of a multi lookup column to paste it in a multi lookup column in another list ?

Do you also need help to get the value of a multi lookup column ?

Reply
Workflow Hero

Re: How Can I Update a Multi-value Lookup Column

Jump to solution

That is correct.  Both are multi select lookup columns pointing to the same parent list.  So if the lookup column in List A from List C (Parent) has values of Cat, Dog, Bird I want to update the lookup column in List B (Same List C Parent Column) to also store values of Cat, Dog, Bird.

Reply
Workflow Hero

Re: How Can I Update a Multi-value Lookup Column

Jump to solution

ok and you need to query List A to get items that have Cat, Dog and Bird values for the multi value lookup column ? Or do you want to loop through all items of list A ? How do you know which items of list B have to be updated ?

Reply
Workflow Hero

Re: How Can I Update a Multi-value Lookup Column

Jump to solution

I already know which list items need to be updated based on separate criteria that links the two list items together - I'm just struggling with how to update the lookup columns

Reply
Workflow Hero

Re: How Can I Update a Multi-value Lookup Column

Jump to solution

For a multi lookup value, it should look like this :

2;#Cat;#3;#Dog;#4;#Bird (item ID;#item Title;#another item ID;#another item Title)

To get this value from an item, you can call the following web service using "call web service" action :

  • Url : your_site_url/_vti_bin/lists.asmx
  • Web method : GetListItems
  • Editor mode : SOAP editor
  • Web service message :

<?xml version="1.0" encoding="utf-8"?>

<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">

  <soap:Header>

  </soap:Header>

  <soap:Body>

    <m:GetListItems>

      <m:listName>The name of the list where you want to retrieve the multi lookup value</m:listName>

      <m:query>     

       <Query>

        <Where>

         <Eq>

          <FieldRef Name="ID" LookupId="TRUE" />

          <Value Type="Text">ID of the item where you want to retrieve the multi lookup value</Value>

         </Eq>

        </Where>

       </Query>

      </m:query>

      <m:viewFields>

       <ViewFields>

        <FieldRef Name="internal name of the multi lookup column" />

       </ViewFields>

      </m:viewFields>

    </m:GetListItems>

  </soap:Body>

</soap:Envelope>

  • Web service output : Default value
  • Store result in : single_line_of_text_variable

Then to extract only the value of the column, you can use a Query XML action :

  • XML source : XML
  • XML : single_line_of_text_variable
  • Process using : XPath
  • //@ows_internal name of the multi lookup column
  • Return result as : Text
  • Store result in : single_line_of_text_variable_to_store_result

Then in your variable single_line_of_text_variable_to_store_result  you will have the correct format of the multi lookup value column and you will be able to update the item using the "Update item" action and this variable.

Hope it helps

Reply
Workflow Hero

Re: How Can I Update a Multi-value Lookup Column

Jump to solution

Thanks!  I'll give this a try     

Reply
Workflow Hero

Re: How Can I Update a Multi-value Lookup Column

Jump to solution

Hi Caroline,

Why would you prefer to use the Call webservice rather than the 'Query List' action. It's much simpler to implement (but less powerfull of course), but in this case, it would make the job.

Reply
Workflow Hero

Re: How Can I Update a Multi-value Lookup Column

Jump to solution

I think it doesn't return the multi lookup value in this format :

2;#Cat;#3;#Dog;#4;#Bird

Reply
Workflow Hero

Re: How Can I Update a Multi-value Lookup Column

Jump to solution

Hi Jonathan,

for updating those kind of columns, please refer to this post on my personal blog. Hope that helps.

Caroline Jung​ answer is correct if you want to go down the path of using web service calls, however, Alexandre JOLY​ suggestion is more user friendly and power user focused. Depends on the requirements and audience at the end of the day

Cheers,

Pat

Reply