We have two custom objects A and B which have a many-to-many relationship so they have a junction object J to connect them. Now I am having another custom object C which has lookup field to both A and B. In object C, for field B, I want to implement a lookup filter which requires the picked B has to have a relationship with the choosen A in C object. Is it possible to implement this using lookup filter or something similar. Trigger doesn't seem to be a very nice option though because in the page level it still displays all the options, not just the available ones.

  • Do you mean "while creating J, B has to have a relationship with the choosen A in C object" ? Commented Jul 20, 2015 at 5:51
  • @AmitBangad No. I mean say we A has two objects a1 and a2, B has b1 and b2. Suppose for an object C c1 whose lookup field to A is already set to be a1, then when choosing the B field lookup object, only the ones which has a relationship (through j) to a1 can be considered. Does that make sense?
    – Lance Shi
    Commented Jul 20, 2015 at 6:31
  • yes, it makes sense on what you are looking to accomplish. It wont be possible to accomplish this straight forward using lookup filters. Let me think if we can tweak to achieve this w/o trigger or VF page. Commented Jul 20, 2015 at 6:34
  • @LanceShi did you think about setting up validation rule for it?
    – Ashwani
    Commented Jul 20, 2015 at 6:47
  • @Ashwani thanks for that. But the point here is I am trying to avoid coding and trigger is perfectly okay. But the issue the trigger is when end user looks at the option list in the page, he/she has no idea which ones are available. Yes, by validation rules or triggers we can pop up error message. But we still can't tell user which ones are the right ones to choose from.
    – Lance Shi
    Commented Jul 20, 2015 at 6:51


You must log in to answer this question.

Browse other questions tagged .