1

I've defined two list definitions and instances in a feature in VS2010.

One list only contains a required field "Employee" which is of type User.

The second list has two fields, a simple text field and a lookup field to the first list. Here's the field definition from the Schema.xml

<Field ID="{DC591BA2-D262-4810-B697-BE2E6AF64226}" Name="UserLookup" EnforceUniqueValues="TRUE"  DisplayName="Employee" Type="Lookup" Required="TRUE" List="Lists/User" ShowField="EmployeeName" Indexed="TRUE"></Field>

This works fine, and when I use new or edit forms, I get the names of the values in the first list. But in the view, the value is #ERR instead of the name. I changed it to ID and that shows fine, but the name won't show - anyone got any ideas?

Relevant schema.xml from the first list:

<ContentTypes>
      <ContentType ID="0x01006ffb64509c2341d2bff13b98859f792b" Name="User" Description="" Inherits="FALSE" Version="0">
        <FieldRefs>
          <RemoveFieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Name="Title" />
          <FieldRef ID="{97666FB8-EF69-4063-924F-06E459383B7D}" Name="EmployeeName" Required="TRUE"></FieldRef>
        </FieldRefs>
      </ContentType>
    </ContentTypes>
    <Fields>
      <Field ID="{97666FB8-EF69-4063-924F-06E459383B7D}" Indexed="TRUE" Name="EmployeeName" DisplayName="Employee" Type="User" Required="TRUE"></Field>
    </Fields>
1

The problem is using People and group column which cannot be made as a look up column in another list.

You may use a text field to do the lookup by creating a text field in the first list, and set the value to user and group field name.

Then you can use the field you created as lookup to another 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.