To search for child customers under a parent customer for unlimited levels in NetSuite using a Saved Search, you can still use the Parent (Hierarchy) field, which is designed to search across all levels of hierarchy without needing to manually define the number of levels.
Here’s how to create a Saved Search to retrieve all customers under a parent, no matter how many levels deep:
Steps for Unlimited Level Hierarchy Search:
- Navigate to Saved Search:
- Go to Reports > Saved Searches > All Saved Searches > New.
- Select Customer as the record type.
- Set the Search Criteria:
- In the Criteria tab, click Add Filter.
- Select Parent (Hierarchy) from the list of filters.
- Set Parent (Hierarchy) to be any of and then choose the parent customer you want to start from. This field searches all child customers under the selected parent customer, regardless of the number of levels.
- Customize the Search Results:
- In the Results tab, add fields like:
- Customer Name
- Internal ID
- Parent (Hierarchy)
- Level (Number of sub-levels)
- This will ensure that all child customers are listed with their parent hierarchy, helping you track the structure.
- Optional – Display Hierarchy Levels:
- If you want to display the level of hierarchy, you can use a Formula (Text) field:
sql
Copy code
CASE WHEN {parent.parent} IS NULL THEN 'Level 1'
WHEN {parent.parent.parent} IS NULL THEN 'Level 2'
ELSE 'Level 3+'
END
- You could also use Formula (Number) to calculate the number of hierarchy levels:
sql
Copy code
LENGTH({parenthierarchy}) - LENGTH(REPLACE({parenthierarchy}, ',', '')) + 1
- This will give you the number of levels deep a customer is under the original parent.
- Add Sorting:
- You can sort the results by Parent (Hierarchy) or Name to get a clearer structure of the customer hierarchy.
- Run the Search:
- After setting up, run the search to get the list of all child customers under the parent across unlimited levels.
Key Points:
- Parent (Hierarchy) handles unlimited levels in the customer hierarchy, so you don’t need to specify a fixed depth.
- The Formula (Text) or Formula (Number) fields can help you visualize the levels of hierarchy.
This approach allows you to search and display all customers under a parent, no matter how deeply nested the hierarchy is.