How to set value on Lookup column using a workflow? (SharePoint 2010)

Hi All,

I'm new to this forum, so please forgive me if i've missed something in this post. I've been trying to find an answer to this for a while now, one of those head scratchers that google and forum searching doesn't seem to clarify. I'm new to SharePoint so that probably explains alot also.

I have a list (List A) which has a few lookup columns which fetch information from other lists on the same site. Quite straight forward, except I'm trying to get a workflow on List A to update these lookup columns with different values when updates are made in other lists. I'm using the action "set field to value", with the field being the lookup column and the value being the new value.

Problem is though that this doesn't work, the value doesn't set. I figure this has something to do with the fact that values in the lookup column are not referenced by value but in fact by some generated index, but I'm not familar enough with SharePoint to understand if this is the case.

Anybody have an idea how to do this?

Thanks in advance.

February 13th, 2012 4:42pm

Hi there,

The issue you are having is that lookup values also have an ID you have to add.

Your lookup value is not:

value A

But it is:

12;#value A

How I solve it:

I create a calculated column in the lookup list that adds the ID + ";#" + title

That way, in your workflow you can set the field where the value equals the calculated value

Free Windows Admin Tool Kit Click here and download it now
February 14th, 2012 7:07am

Hi,

Amazing! Works like a charm. Thanks very much for your help.

February 14th, 2012 11:31am

I  solved this using a similar method, by using the "Set Field to Value" action, but instead of using a calculated column, I use the "Set Workflow Variable" action (e.g. "lookupvalue", and then set the Lookup field to the value of the workflow variable, as an Integer.

It's a little more elegant, and there's no need to refer to a calculated column that only changes if a user edits the item.

  • Proposed as answer by jreinoehl Friday, April 04, 2014 3:00 PM
Free Windows Admin Tool Kit Click here and download it now
March 29th, 2012 8:36pm

I feel like this thread has the answers I'm looking for, but I'm having trouble applying the suggestions here.

In my case, two lists are involved: "Jobs" and "Contacts."

Each Job has an Initial Contact field (a lookup column to the Contacts list).

When a job is created, sometimes the Initial Contact will already be in the contacts list, and sometimes he won't be.

If he is, the form user simply selects the name using the lookup control in the form. If he's not, there's a place on the form to enter the new contact data. In that case, once the form is submitted, a workflow takes the new contact information and creates a new entry in the Contacts list. The problem is then getting the workflow to associate this newly created contact with the blank Initial Contact field in the newly created job. I can't get the workflow to perform the lookup from Jobs to Contacts.

I'm using the Set Field in Current Item action.

The Field is the Initial Contact field in the current item.

The Value is supposed to be the Full Name field in the newly created contact. I think my problem is putting the right information in the "Field Data to Retreive" and "Find the List Item" sections of the Set Field action's value lookup. I've tried many different solutions (over the course of three hours), and I've tried implementing both suggestions given here, and I'm still failing (GAH!).

If either of you responders above could give a little more specific detail about how exactly I should implement the calculated column or the workflow variable, I'd appreciate it.

Thanks.

April 19th, 2012 6:41pm

Hah! Thanks to this thread I have my answer!

I needed to set the Value in the "Set Field in Current Item" action to an item ID, not to the contents of the actual column in that item that I wanted. The software automatically extracts the data from the column that matches the field I'm filling as long as I simply supply the item ID.

In my case, the easiest way to get that ID was simply to use the ID variable:create that was automatically returned when the new Contact was created by the workflow.

Whew! I learned something today.


Free Windows Admin Tool Kit Click here and download it now
April 19th, 2012 7:55pm

I am having a similar, but slightly different, problem. I hope you answer guys are still listening...

I have 2 lists. List 1 looks up a value "Code" (shows as a drop-down) from List 2.

After creating a new item, I have a SPD workflow that wants to calculate a total value based on a "Unit Cost" stored in List 2 times a "Number of Units" value in List 1 and store it in the "Total Cost" column in list 1.

When I run my workflow, I get "0.00" as a result, which tells me that the lookup is failing to find the correct row in List 2.

I tried the calculated column idea using "=[ID]+";#"+[Title]", but all I get is "#Value!" displayed in the column.

Help!

January 15th, 2013 6:34pm

IMO - This solution is much cleaner and worked perfectly.
Free Windows Admin Tool Kit Click here and download it now
April 4th, 2014 3:00pm

Hi,

No need to use lookup column, you can use lookup column with its ID associated with this. & try it will work.

Regards:

Munish Kumar

November 13th, 2014 11:13am

I tried the calculated column idea using "=[ID]+";#"+[Title]", but all I get is "#Value!" displayed in the column.

Free Windows Admin Tool Kit Click here and download it now
March 20th, 2015 2:03pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics