0

When we create lookup column OOTB, there is option "Add a column to show each of this additional fields", so that we can have more than one show fields in list for that lookup.

But how to do same thing if we are creating List by visual studio?

Please have a look at following screenshot for more ref. enter image description here

1 Answer 1

2

To setup the additional field from the lookup, you need to add a second lookup field pointing at the same list, but include the FieldRef attribute on the second lookup field. The value of this attribute should be the same as the ID attribute of the first lookup field.

<Field ID="{5D184D01-082C-4831-8757-CA2C98F05221}" Name="Title" DisplayName="Title" Type="Lookup" Required="FALSE" Group="<GROUP>" ShowField="Title" List="Lists/EmpConfiguration"></Field>

Additional field can be added as follows:

<Field ID="{393F697A-7F99-488E-B67F-41DFD6D41857}" FieldRef="{5D184D01-082C-4831-8757-CA2C98F05221}" Name="EL" DisplayName="EL" Type="Lookup" Required="FALSE" ShowField="ID" List="Lists/EmpConfiguration"></Field>

Notice the ID of first field and FieldRef id of second field is same.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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