function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
vr8cevr8ce 

Two-step lookup

Challenge: We have a list of codes. The list has four levels, represented in four fields on the code row, the last level being the detail. For example, a top-level row has something in level1 and nothing in level2-4. A detail row has something in level1-4. There are too many (1000+) rows to use as a picklist. We want to choose the level1 we want, then choose from the detail rows that have that level1.

Let's call the custom object Object1, and the codes object Codes.

I created Object1.Field1 as a lookup to Codes, with a filter of Codes.Level2-4 = "". So far, so good.
I want to create Object1.Field2 as a lookup to Codes, with a filter of "Object1.Field1 = Codes.Level1" and "Codes.Level4 <> "". In other words, choose from Codes where the top level matches the one I just picked, and only choose the rows that have all four levels.

When I try to use a "field" instead of "value" on the Field2 filter, it doesn't give me the fields from Object1 to choose from. So I don't have a way to restrict the lookup to just those that match the top-level I just picked.

Is there another way to solve this? Breaking up the codes into multiple objects won't work; it's the current record that it won't give me the fields for in the filter, not the lookup object. That is, it doesn't appear to allow filtering based on another value on the current (new) record.

I realize we could do it so the user could change the initial filter, and then just use one lookup. But the entry volume is too high, and the users too inexperienced, to make that practical. I really need to give them two picklists, the first one determining the values in the second, and the volume of the codes (and other considerations not relevant here) requires they be in an object.

Is there a way to do a two-step process so that we're not choosing from 1000+ codes (which we obviously can't do)?