Is it possible to update an item with a lookup column?

  • 20 September 2016
  • 9 replies
  • 139 views

Badge +7

Hi.

I use SharePoint 2013 with Nintex. I created a workflow in Nintex and the workflow errors because it cannot update an item.

The item I want to update has a lookup column. (Lookup title from the same list where multiple values are possible --> is this the problem?). Is this possible in general?

Thank you!


9 replies

Badge +7

Yes, you need to use the ID to do your lookups and not the text value.

Badge +7

Hi - I just tried it and its working. But when people fill out the 'New Item' form they need to see the title at the lookup.. they probably don't know the ID of every singe item in the list. Any ideas for a workaround?

Badge +7

And it still doesn't work with multiple values - at least in my case.. :/

Badge +7

When you create your Lookup Column in SharePoint it should show the Text Value of the look up and this is the same for Nintex Forms. In the forms Designer, if you select your lookup control,  and in the settings make sure the ID is connected to the Column Name of the text you want to show up. The IDs are just used in your workflows, and the text values should show up in your drop down. All lookup columns have 2 parts, the value (which is your ID) and the Display (which is your Text), so when creating your Lookup Column Select the List to get information from, and then select the Title, or whatever text value you want to show in your drop down. It will ways create the relationship with the ID in the background.

In your workflow you will need to do a

1 )Query List Action to get the ID of what was selected in the drop down.

2) Then you will want to do another Query List Action to get a collection of Titles that you want to update.

3) Then loop through your Title Collection and do your Update Action.

      a) Within your update action what ever column is your look up column update with the ID you got form your 1st Query               List Action.

I hope this helps.

Userlevel 4
Badge +11

Hi,

if you need to update a lookup field with multiple values, you have to set them as the following way:

ID1;#;#ID2;#;#ID3 

so you have to build a string with all the id of the element you want to connect separated by ;#;# 

Using that syntax you should be able to update a lookup field with multiple values.

Giacomo

Badge +7

Hi Ben!
Sorry for the late response, I had to do some other sharepoint stuff but now I am back to this issue.
I am not using Nintex forms.. just Nintex workflows. For the forms (eg. Edit Form) I use the code in SharePoint designer.

So I have to choose if the lookup should be ID or title.

I tried it with IDs and multiple values and it works now. So my next step is to change the view to title. Do you know if I can do this via code?

If I want to solve this in the workflow I still have the problem with updating a lookup column (which just works with IDs not with title - is that right?)

Thanks!

Badge +7

I just tried to change it via code and I think its not possible, because the code doesn't change when changing the column (edit column --> in this column: title (linked to item) or ID)

Badge +7

Okay I got a solution: with the ;#;# hint (from Giacomo Gelosi Champion  comment) I was able to update the lookup columns with IDs.

Then I created a new column (lookup: title and show ID in another column) and I am hiding the ID columns in the Edit/New/Display form and in my view.

So the person who fills out the forms just sees the title in the lookup and the rest is happening in the background (hided columns and workflow that synchronizes the columns all the time). Maybe not the prettiest solution but it works..

Badge +1

Hi Thzu,

 

I am currently trying to create a updatable column which is similar of a "status title" and I want to be able to update this column by using lookup to find a unique ID. I am new to nintex workflow so I dont really understand everything that has been explained here. Do you have an example or screenshot to show your workflow so I can learn from it? 

 

Thanks!

Reply