Filtered Lookups, Validation Rules, and Order of Execution
Reading the cheatsheet for Filtered Lookup (beta), I noticed an interesting line:
Lookup filters function similarly to validation rules when you save a record. That is, actions that cause related records to save, such as changes to a roll-up summary fields, also trigger the lookup filters on the related record and block the save.
The implications for this are massive. Let's explore two examples:
Example 1: Filter as Validation Rule from Parent Record
- We create a lookup on a Child object to Parent.
- We filter the lookup to EXCLUDE Parent.Status = 'Closed' (Parent.Status is only Open or Closed.)
- We can edit the Child records as long as the Parent Status is not Closed.
- When Parent.Status is changed to Closed, existing related Child records are not affected...
- BUT if we attempt to edit a Child when the Parent is Closed, Force.com will throw an error (which we can customize) beause that the Lookup is invalid.
- (and clearly we cannot add new Child records either)
Conclusion: Thus, Filtered Lookups act much like Validation Rules. A quick experiment shows that Filtered Lookup errors actually fire before Validation Rules.
Example 2: Filter as Validation Rule on Roll-Up Summary (from Child Record) - what the line above was referencing
- Use the above example, but change the lookup to a master-detail relationship
- Create a Roll-Up Summary field to count all child records
- Prevent saving more than 10 child records for one parent record
Here, we have triggered a filter error without touching a parent record, yet we throw an error based on a value on the parent record.
This second example is significant because we could already prevent more than 10 child records from saving, but doing so required a Roll-Up Summary field on the parent object AND a Validation Rule on the child object. Now we can replace the Validation Rule with the Lookup Filter, though we still need the Roll-Up Summary field. Whether or not this simplifies things is definitely up for debate...
Conclusion
This is a very powerful feature! Thanks to salesforce.com for rolling it out, even in beta form.
Real world example: The above example would be great for Time Sheet Entry and Time Sheet Header objects, as they would create, in effect, a validation rule on the Header record preventing editing of any child records. Awesome!
For further reading, check Salesforce Help's Lookup Filters examples.
Preparing a New Org
With the impending arrival of the Winter 2010 (aka 162 or Winter'10) edition of Salesforce CRM, as with every other release, comes a prerelease org. (You can get one at https://www.salesforce.com/form/trial/prerelease_winter10.jsp.)
Every time one encounters a fresh org, there are maintenance tasks to perform. I usually go through an org (whether a Developer Edition org or a Prerelease version) and do the same tasks, generally in no particular order. This time, however, I wrote down what I did as I did it. Looking at the list, it's hardly in any "best practices" order at all - it's just how I did it.
There's no need to follow every step, and it is not a complete list of all possibilities, but this should give you some idea of the possibilities and available tweaks: (*** indicates some of the new features in WInter '10)
- Save login with 1Password/Roboform
- Reset (Set) Security Token
- Administration Setup | Security Controls
- Session time 8 hrs
- Passwords never expire
- Create Record Types (and Business Processes) for Lead, Opportunity, Case
- (Campaigns were not enabled in this prerelease org) - would have configured them here, similarly
- Activities section: Calendar link on sidebar
- Download latest versions of Connect for Outlook, Office Edition
- Opportunities:
- Enable Similar Opportunities
- Enable Opportunity Teams
- Create Account Master Record Type
- Enable Account Teams
- Create Contact Master Record Type
- Note: Asked to add to page layout. Not asked for Opportunities.
- Enable Case Teams
- Enable Public Solutions
- Solutions:
- Enable Solution Browsing
- Enable Solution HTML
- Could have created a Solution Process & Record Type
- Did not enable multilingual solutions
- Enable Self-Service
- Enable Web-to-Case
- Create default Owner, etc (auto prompted)
- Enable PRM and Partner Portal (though have no licenses)
- Salesforce to Salesforce
- Enabled S2S
- Set up S2S Connection Finder ***
- Added fields to page layout - Kept read-only for all profiles except System Administrator
- Enable Public & Private Tags
- Enable Console for all Profiles
- Search Settings - Enable Enhanced Lookup & Auto-Complete
- User Interface
- Separate loading of related lists
- Spell Checker on Tasks & Events
- Collapsible Sidebar
- Custom Sidebar on all Pages
- Enhanced Profile Management ***
- Set myself as default Workflow User
- Looked at Develop | Custom Settings ***
- Created a Default Queue and added myself
- Set all Sharing Rules to Private
- Update Home Page to the way I like it
- Order of wide section (top down): Calendar, Tasks, Items to Approve, Dashboard
- No changes to narrow section
Other things that may be possible in other orgs:
- Enable Customer Portal
- Customize Campaigns
- Set up Sites
Again, this is not meant to be a complete list. Also, it is not intended to be a how-to; for more information you may search the Help link at the top of every org page, check Salesforce Community, or Developer Force.
Happy configuring!
Dashboards are Improved AND New in Summer 09
The Summer09 prerelease orgs are here, so get yours now! Upon first look, something cool stood out and merits immediate posting:
Dashboards are improved. The colors are more vivid, there’s detail in the bars and pie chart wedges, and… pie charts can now display the actual and percentage values!
Dashboards are also new. Visualforce pages can now be included as dashboard components, and there’s a new “Color-Blind Palette on Charts” setting for each user. Here are before and after shots.
Flexible Field Labels
Force.com Sites Guest User Profile Permissions
I’m working on an event registration application for the Sites Developer Challenge, and it involves a validation that the registrant’s email exists in a Contact record. Remembering that Steve Andersen had run into some obstacles with Contact.Email visibility, I decided to check the guest profile for Contact Field Level Security. Here’s what I found:

Guest profile Contact Field Level Security
If you squint a bit, you can see that the Opt-Out and Email fields are hidden to the guest user. I have no idea why these, in particular, are hidden. Likewise, I couldn’t find a pattern in which fields were shown on the custom objects I had created, nor which were visible on standard objects.
In any event, I don’t have any pearls of wisdom on this topic; this is more of an informative note to all that are using Sites (especially if you plan to do any communication-subscriptions) to check out the Field-Level Security.
For those wondering how to get to this Profile (since it is not visible in the usual Profile section), go to the Sites page > Site Name or URL > Public Access Settings (a button).






