How do you convert string field to lookup?

  • 23 March 2016
  • 6 replies
  • 32 views

Badge +11

I have a string field in one list and I need to take the value of that string and pick the value of a lookup in another list. How do I do that with the shortest workflow possible? I have to do this with quite a few fields. And there are over 100 items in the list that I need to convert this field. Also, there may be about 10 or so items in the lookup.

So just to be clear, in one list the string field may be 'Blue' and I need to take that in the other list where there is a field called 'Color' that is a lookup field and in that lookup field there is an item that can be selected that is 'Blue'. In that lookup, there will be other colors as well.

I am using SharePoint 2013 and Nintex 2013.


6 replies

Badge +7

Hello, Can you elaborate a bit more?

You have a string column in one list, and eg value is blue. And you have a lookup column in another list and eg value is blue. Then what you want to make after getting this data?

Badge +11

I need to match the column in the target list with the value from the source list. I have a dataID I can use. I cannot use the built in SharePoint ID. I have to use the dataID. So if dataID 5 in the source has a color red in the string field, I need to find dataID 5 in the target field and select red in the lookup column.

Badge +7

You can follow below things for this:

1) Create a site workflow to Query your source list.

2) Get all fields what you want here, Item ID, dataID, string field; you have to save all these in workflow variable of type collection

3) Loop through the collection variable where you saved your Item IDs (for each loop)

4) Inside foreach use collection operation to get the respective dataID and string data for Item ID and save them in the Number and String type workflow variables

5) after getting dataID and string data, use query list action to query your 2nd list and here filter to only get the item if it matches with dataID

6) Then you can update the item or do whatever based on your requirement.

Badge +11

Ok, I'm ready to work on this. I did a Query list action for the source list to get the ids because they will be in the target list. I have the foreach action setup that will loop through the ids from the source list. I need to get the info from the lookup list. I need a screenshot on how to do the rest of this.

Badge +11

Here is what I have so far. But I am getting an error 'Failed to query list data. Object of type 'System.String' cannot be converted to type 'Microsoft.SharePoint.Workflows.SPItemKey'.

Lookup.jpg

Badge +11

Its working!!!! I changed the workflow!

Reply