Here’s a great example. Our committees module doesn’t include a sub-committee link as a standard feature. But a couple of our clients do have sub-committees they want related back to the parent committee. What to do? Pay for an expensive customization? No way! Got 10 minutes? We’ll add sub-committees in that amount of time to the object and to the page layouts used by our users.
[Note: These steps would be performed by your system administrator.]
1. Go to Setup > Create > Objects and find the Committees object.
2. Under Custom Fields & Relationships, click New to create a new field.
3. In step 1 of the New Custom Field wizard, for the field type, select Lookup Relationship. Click Next.
4. In step 2 of the wizard, select the object to relate to: Committee. Click Next.
5. In step 3 of the wizard, you name your field and set some options. Here are my suggested values:
- Field Label: Parent Committee
- Field Name: Parent_Committee
- Help Text: If this committee is a sub-committee, use this field to link this sub-committee to its parent committee.
- Child Relationship Name: Sub-Committees
- Do NOT check the Required checkbox
- What to do if the lookup record is deleted? Leave the default: Clear the value of this field.
6. The Lookup Filter. This is important. We want to make sure that users can’t link a committee to itself. This could be done as a validation rule, but we can actually do it right here in the Lookup filter area.
- Set the filter so that the Current Record Committee: Record ID does not equal the Current Lookup Parent Committee: Record ID.
- Set the Filter Type to be Required so that this rule is always used. Provide an error message. I use: The parent committee cannot be the same as this committee.
- Be sure the Active checkbox is checked so your filter is enabled. Click Next when you’re all set.
8. In Step 5 of the wizard, be sure the checkbox is checked to add this new field to the page layout called Committee Layout. Click Next.
9. In Step 6 of the wizard, set the Related List Label to be “Sub-Committees”. Do leave the checkbox checked to add the related list to the Committee page layout. Do leave the checkbox checked to Append the related list to users’ existing personal customizations. Click Next.
Click Save to save what you’ve done.
Now to see it in action. For our sample association, we have the Budget and Finance Committee, which is actually a sub-committee of the Board of Directors. To record that relationship, we go to the Budget and Finance Committee’s record. Here we’ll see the new field we added — Parent Committee:
If I try to add the Budget and Finance Committee here, we can see the impact of our Filter rule. First, you’ll find that it won’t come up in the search window at all. And second, if I insist on trying to link a committee to itself by just typing in the name Budget and Finance Committee, I’ll see this message: