Search Record in parent -child relationship.

Hi I have created Region Object.
It has multilevel hierarchy.
For Example.

D is the child of C.C is the child of B.B is child of A.
Now i need to provide filter when i am searching with A all the records of A,B,C,D should be populated.

When I am search with B All the records of B,C,D Should be  populated.

Same way when I search for C all the records with C and D should be populated.

Let me proper Idea how can I achieve this task.

If you are using one object and have built a lookup to that same object in order to build a hierarchy this is pretty simple.  For the sake of example I’m going to build an account detail page - showing its region identification,  using a region hierarchy.  I assume that the account record has a lookup to region in order to get the most granular regional location. 

Then create a second model to show “parent regions”   This model will have four conditions. 

1. Region_Name= AccountModel.RegionLookupField
2. Parent.Region_Name= AccountModel.RegionLookupField
3. Parent.Parent.AccountModel.RegionLookupField  Region_Name= AccountModel.RegionLookupField
4. Parent.Parent.Parent.Region_Name= AccountModel.RegionLookupField  

The grouping logic on these conditions will be (1 OR 2 OR 3 OR 4)

This way no matter what level of region is identified with the account - the regional hierarchy on top will be shown. 

Thanks Rob.
But I need this functionality for filter record.Not for display Record.
I need to add filter for searching.
I have to create this functionality on grid page not on detail page.
Let me know some more suggestion .

For Example:

See Above Screen shot.

For Example

I have three records.

Rohit1 who’s Permanent Region is C.
Rohit2 who’s Permanent Region is B.
Rohit3 who’s Permanent Region is A.

So when i will Select A From Filter all three should be display.
IF I Select B than Rohit2 and Rohit1 Should be display.
IF I Select C than Rohit1 Should be display.

In order for this to work you will have to do some work in Javascript. Here is an initial sketch:

  1. Revise all your conditions so that they have a blank value, and are “Filterable default off”. This will give them a filter name (which you can adjust). Keep the grouping logic as shown above.

  1. Create a new model that groups all your records by region (we are just getting a list of regions here that we can use as a model source)

  2. Then create the permanent region filter on your table and make the following adjustments.
    a. Pick options and Conditions - Manually.
    b. Model Conditions to Affect - None
    c. Create “None Selected” Option - Off.

  3. Add 2 Filter Option Sources of type Manual.
    a. First source properties:

    • Conditions affected: Affect Other Conditions.
    • Lable = “All Regions”
    • Add as many Effects as you have conditions. All the effects should be to deactivate the conditions.

b. Second source will be of type “fields in a model”
- The merge source should be the model you created in step 2.
- The “Conditions the source options affect” property should be “Default condition and others”
- Then create Effects for each condition and pass the “Id” field from the model as the value to inject into those conditions.

This should give you a list of all available regions, and when one is selected, pass it along into all the region conditions you have set up.

Good Luck.

Note: An intial answer provided required some Javascript code.  I subsequently realized that it was not required and edited the response above.  If you are worried about the Javascript - worry  no longer…

Thanks Rob.

Thanks Rob.