1

I'd like to create a lookup column in my list (hopefully using OOTB functionality) that shows a column from another list. Sounds simple enough, but the available columns to choose to lookup from my source list only consist of Dates or Text types. The column I want to pull is of type Person or Group. I read that this might not be allowed, since it is like doing a "Lookup of a Lookup". Is there any way around this?

1

There is no way you can do this OOTB in SharePoint. So you have to do some coding to get your solution.

Here is a sample code which performs the operation you want.

     /// <summary>
    /// Create LookUp Column in Site Columns
    /// </summary>
    /// <param name="fieldName">LookUp Field Name</param>
    /// <param name="fieldTitle">LookUp Field Title</param>
    /// <param name="required">Field Required or Not</param>
    /// <param name="allowMultipleValues">Multiple Allowed or Not</param>
    /// <param name="sourceList">Source List of LookUp Column</param>
    /// <param name="destinationlist">Destination List of LookUp Column</param>
   /// <param name="sourceField">Source Field of LookUp</param>

    public static void CreateLookupField(string fieldName, string fieldTitle, bool required, bool allowMultipleValues, SPList sourceList, SPList destinationlist, string sourceField)
        {            
            try
            {
                destinationlist.Fields.AddLookup(fieldName, sourceList.ID, required);
                SPFieldLookup lookUpField = (SPFieldLookup)destinationlist.Fields[fieldName];
                lookUpField.AllowMultipleValues = allowMultipleValues;
                lookUpField.Title = fieldTitle;
                lookUpField.LookupField = sourceField;
                lookUpField.Update(true);
                destinationlist.Update();
            }
            catch (Exception ex)
            {

            }            
        }

If you have any doubt in this code then ask me.

4

I did this with less coding in sharepoint 2010. Here's what I have:

  • List called PeopleList with columns "Person" and "Title".
  • Workflow called "CopyPersonFromTitle", which runs when an item is created/changed.
  • A list called CustomListWithLookup, which has a Lookup with the following configuration. Get Information From: PeopleList. In this column: Title. Allow multiple values: yes

CopyPersonFromTitle workflow:

If CurrentItem.title is empty  
Set CurrentItem.title to CurrentItem.Person (display name as string)
1

The easiest way would be having a workflow running on the "People and group" lookup list, which copies the name from the people field to a simple text field. Then target the text field in the lookup.

Assuming people does not change their names very often in your organisation (a fair assumption I'd say) the risk of having mismatch between the people field and the textfield is very, very, very low.

0

I did this using Microsoft Flow. Before that create a calculated column in your Microsoft list.

  • When a new item is created
  • Update Item , in the respective columns (Calculated), Select Personcolumn. DisplayName

This should enable you to select using lookup for person name in your secondary SharePoint List.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.