Question

I know the title may be confusing, but I'm not sure how to word it better.

I have a column from which my users will select an value in a look up table. Based on what they have selected, I want a work flow to run to set a second column's value to another field from the same look up index.

Example:

Column1 | Column2
Arnold  |  22
Jerry   |  24
Sam     |  45

In my list, if my user selects "Arnold", I want a workflow to assign the number "22" to another field in my list. This is done twice so I can then compare the two "number" values (essentially determining if Arnold is younger than Jerry.. if so, Arnold is then assigned in another field as an owner). Is there a simplistic way to do this? I think I will be okay on the comparison, but properly reading from the look up table is what's confusing me right now as a novice SharePoint developer.

Was it helpful?

Solution

One way to do this would be to have your multi-column lookup list stored as a separate list in SharePoint (Maybe you already have that I'm not clear). When you then add a lookup column to your 'main' list that refers to this lookup values list you can select which additional fields to include. You could, for example, include Name and Age.

Adding additional fields to a lookup column

When including these additional fields, only the first one is editable, the rest are populated automatically. In effect, your user selects a 'Name' and 'Age' is automatically set to the corresponding value. I think that addresses the first part of your problem.

The next part, where the same process is repeated, would be met by simply adding a second column to your list with the same setup. In effect you'd have 'Person 1' and 'Person 2', you could compare ages by simply looking at the corresponding fields.

Multiple lookup columns with additional fields

Once you have these values you can access them in your workflow just like other columns and do what you like with the values:

Additional lookup field in workflow

OTHER TIPS

@Chaholl's answer is correct but if you need, as was our case, the url value from a field in the lookup item, this won't be sufficient as it is not exposable under "additional fields", as are some other field types.

In this case you would need what you are suggesting yourself, a workflow:

  • that runs whenever an item is created or updated
  • that copies you necessary values to your listitem that has the lookup to the original item.

This is very easily done in SPD using the SP 2010 workflows, and you can make them reusable if you have Content Types, which is the approved way to go.

There's nothing much to it:

  • Read curent List Item lookup field, select ID property
  • Get list item from correct list, matching on ID
  • Get lookup list item field value (field you want to copy)
  • Assign to current list item
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top