One of the neat features in CRM is the ability to restrict a Search Select Advanced (SSA) field by another field. An example of this behavior can be seen in the Web Picker screens where the Person SSA is restricted to the people in the company that is selected in the Company SSA.
You can even create your own SSA fields and have one restrict the other. (See Jeff's blog post for instructions on how to setup your own SSA here)
This may seem as a pretty straight forward feature and you might never stop to ask how it actually works until... it doesn't.
To begin to understand how it works behind the scenes let us consider this example:
You have 2 fields xxx_manufacturerid and xxx_modelid. The xxx_modelid field has the restrictor set to be Manufacturer.
When you use the SSA field CRM does a select like the following:
SELECT * FROM Model WHERE mode_xxx = xxx_manufacturerid
The problem is how does CRM know what the mode_xxx field is?
What CRM does is to try and work it out based on the field names - so if your restrictor is Manufacturer - the look up family for this is 'Manufacturer' so it tries to find a field on the Model table that has 'Manufacturer' in the name. E.g. mode_manufacturerid would match. If it finds a field that matches then that field must either be an Integer type or a SSA with the same lookup family (Manufacturer)
This stuff may be a bit hard to get your head around at first but if you read over it a few times it should make sense. If it still doesn't, post a comment!