0

Are there a way OOTB if i have a lookup on my own custom list.

If i select an other item. The other item is automatically linked.

For example.

I have list "test" with a lookup on "test" (so same list)

Inside I have 2 items( A and B)

In the item A. The lookup linked to B

Is it possible that B is implicitly linked to A?

1
  • Its not clear what you're asking. Do you want the lookup field to take the same value as the parent field automatically when you create or modify an item?
    – Akhoy
    Commented Oct 23, 2015 at 3:48

1 Answer 1

1

i dont think their is OOTB way to implement this.

Below is a workaround, i just extracted some useful stuff from this blog: Create list with lookup column associated with the same list or other list.

Lookup column has two important attribute lookup list and the lookup field.

Lookup List: Indicates to which list the lookup filed should refer.

Lookup Field: Which column or field need to be referred or showed from the list specified above.

Here’s the code to fix the solution of Lookup Column in the same list.

  SPList list = web.Lists[listName];

   list.Fields.AddLookup("ParentMenu", list.ID, false);

    SPFieldLookup parentMenu = SPFieldLookup)list.Fields.GetField("ParentMenu");

    parentMenu.LookupField = "MenuName";

    parentMenu.Update();

    list.Update();
2
  • I don't understand why you create the lookup programatically. You can add a lookup on the same list OOT but my issue is the related item is not updated. Commented Oct 22, 2015 at 18:58
  • 1
    that's why you have to use the script...if you read through the blog...you will know the issue
    – Waqas Sarwar MVP
    Commented Oct 22, 2015 at 19:12

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.