Q&A from Validation Rules Webinar: April 21, 2010 - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Mary ScottonMary Scotton 

Q&A from Validation Rules Webinar: April 21, 2010

Did you attend the "Write the Right Rules, Get the Right Data?" webinar on validation rules and lookup filters?  There were over 800 participants and we received over 100 written questions, most of which we were not able to address during the webinar.  Below are the questions and their answers.  Posting here so that folks who were not in the webinar can benefit, too.  If you missed it and would like to see the recorded webinar, it is posted here: https://www.salesforce.com/form/conf/service-validation-rules-webinar.jsp

QUESTION: Is soft validation possible, eg, give people a warning/message, but allow the record save?

ANSWER: No, validation rules can only return errors, not warnings. We have considered adding support for warnings, but do not hear requests for it often. Please post/vote on IdeaExchange if this is something you would like to see on our roadmap.
 

QUESTION: Can lookup filters be used on custom objects to search across multiple fields on that custom object?

ANSWER: In the current release, you can reference fields on the object you are lookup up *to* (you can refernece any field on the Account object when filtering on an Account lookup). In Summer '10 you will be able to reference a subset of the fields on the object you are lookup up *from". In both cases you can reference multiple fields, up to 10 rows of criteria.
 

QUESTION: Can lookup filter apply filter on parent record? e.g. I only want to select Contact on opportunity which is tied to Account on opportunity?

ANSWER: Yes, this is available as of Summer'10 with Dependent Lookup Filters.
 

QUESTION: Can we have this custom error message appear on our custom VF page screen?

ANSWER: Yes. There is a VF component for displaying the errors, and it catches the same errors you would see in the standard pages.
 

QUESTION: We want to filter contacts on Opportunities so that the lookup only consists of related Contacts of the Account that the Opportunity is linked to. How do we do that?

ANSWER: The Contact Role related list does not support lookup filters. If you make a custom lookup on Opp to Contact, you will be able to do the filtering you describe in Summer '10 with Dependent Lookup Filters.
 

QUESTION: Why are validation rules not fired in the standard SF lookup windows?

ANSWER: Adding support for "real-time validation rules" is something we have been talking about. Not all validation rules are appropriate to fire in the lookup window or when values on the page are changed, but some (field formatting, valid value) are. If you think this would be useful, please post to IdeaExchange and see what the community thinks.
 

QUESTION: What happens if the record being "looked up" is edited and no longer fits the validation? For example, a Custom Object with an Account lookup filtered to accept only Type ="GPO". If the Account type changes type -- what happens to all those Custom Object Records that are pointing to it?

ANSWER: Changing the Account type will not impact those custom objects until the next time the custom object record is saved (in this example, the validation rules only fire when saving the custom object record, not saving the account record). The next time the custom object record is saved, the end user will have to select a valid account in order to save.
 

QUESTION: Can the lookup filters be applied to out of the box lookups (Contact Role on Opportunities, only show contacts in the account that have an "active" status?

ANSWER: Contact Role (and Partner Role, and Account Teams) are not customizable and do not support lookup filters. Adding lookup filter support for Contact Role is on the product roadmap but not in the plans for the next 3 releases.
 

QUESTION: re: beta features.. if we start using Lookup filters (for example).. will the final product ever have anything removed? Meaning if we start using Lookup filters in a certain way or process.. can we be safe to assume that once it goes to production, it should continue to work as in beta (but may have more features, not less)?

ANSWER: Great question. The beta label does give us the liberty to "change functionality", and we have taken that liberty within the admin UI for setting up a lookup filter, making changes that we normally wouldn't make once a feature is GA ("optional filter" checkbox turned into two radio buttons to make it clearer). That said, we are being very careful not to regress any functionality or change the result of the lookup filter (i.e., when you get a new release, you should not be seeing more or less records returned in a lookup search). In areas such as the Metadata API, we made sure to plan ahead for additional functionality (such as dependent lookup filters) so that there would not be an impact on upgrade. Short answer is "yes, for the Lookup Filters BETA, it is safe to assume that we are adding functionality, not taking it away; however, you can expect some visual changes".  This may not be the same for all BETA features.
 

QUESTION: Can you show the VLookup object and how it is built?

ANSWER: Great question. This made me take a closer look at our documentation. We tell you how to use the VLOOKUP function, and give some Tips, but you have to reverse engineer the tips to figure out how to build your custom object…my apologies for that gap. I will log a bug to fix that in the doc. For you, I would suggest posting to the developer discussion board for formulas and validation rules: http://community.salesforce.com/t5/Formulas-Validation-Rules/bd-p/custom_formula to ask the community for samples.
 

QUESTION: QUESTION: What do you suggest as a best practice for implementing a filter criteria on a existing lookup fields where legacy selections previously made in those fileds and they don't match the new filter criteria

ANSWER: Great question. We did not have time to dive into this detail in the webinar. This is possible with Summer '10. Two approaches:

1) if the rule should only apply to records with an "open" status, you can reference that Status (or "Stage" on Opp) picklist value from the current record in the lookup filter.

2) if the rule should only apply to new records created as of the date you created the rule, you can hardcode the date into the filter "Created By date greater than or equal to 2010-04-30". Caution: make sure you also include a clause for "Created By date less than 2010-04-30" using Advanced Options, or else no one will be able to save existing records!
For example:

1. Account.Type equals ABC
2. Created By date greater than or equal to 2010-04-30
3. Created By date less than 2010-04-30
(1 AND 2) OR 3
 

QUESTION: Why is this a validation rule and not security control?

ANSWER: I think this is related to the Owner change example. Users need to have Edit access to Owner because the owner is defaulted (to the user) when they create a record.
 

QUESTION: Is it possible to make that information enter in field will be only in capital letter?

ANSWER: In Enterprise Edition and Unlimited Edition, with Workflow Field Updates, it is possible to convert the value entered into uppercase and then store that in the database, but it is not possible to automatically uppercase the letters as the user is typing.
 

QUESTION: Can you use in Activities???

ANSWER: Lookup Filters cannot be used in Activities. This is on the longterm roadmap but is not in the plans for the next three releases.
 

QUESTION: I am not familiar with custom objects - as I have never used them - is there a training session available for those?

ANSWER: We have a full online training catalog, and custom training sessions, available with a through Premier Training. For more information visit https://www.salesforce.com/form/contact/contactme_training.jsp?d=70130000000Er9d&internal=true, and a member of our Premier Training team will contact you.
 

QUESTION: Do you do a basic intro into SalesForce in a webinar?

ANSWER: Sign up for Salesforce Insights (our customer newsletter) and you'll receive notifications of our monthly "Getting Started Webinars." To sign up: https://www.salesforce.com/form/other/insights_news.jsp?d=70130000000F0Ef&internal=true
 

QUESTION: Will you be able to apply an optional account lookup filter on contact roles?

ANSWER: No, Contact Roles are not supported in Summer '10. This is on the roadmap, but no target release yet.
 

QUESTION: Is it possible to develop a custom function or use custom APEX code in formulas and validation rules?

ANSWER: No, it is not possible to cross-over in this way. Interesting idea, though…
 

QUESTION: Does lookup filter only work with custom fields?

ANSWER: No, lookup filter works for both standard and custom fields.  There are some standard field exceptions (such as Created By), which are noted in the online help.  Note that not all standard objects can be filtered on.  See the online help for the latest list of supported objects.
 

QUESTION: Can you set up a lookup relationship for the Reports object and a filter for only a subset of reports? (We need to bring in a look-up field that enables users to choose a report link. Note - this is for a the Acct Plans object we added from the appexchange.)

ANSWER: No, you cannot create a lookup to the Reports object.
 

QUESTION: cross object validation rules can only be used if the relationship between objects is a master-detail, correct?

ANSWER: No. Cross-object references can be made across Master-Detail and Lookup relationships. Note that they cannot be made via the Owner relationship or from Activities (Events & Tasks).
 

QUESTION: Can you filter a related list?

ANSWER: No. This is on the product roadmap, but not in the plans for the next 3 releases.
 

QUESTION: Is it possible after the lookup filter applies to have the field select the most recent record, such as automatically selecting the most recent contract record for a customer?

ANSWER: The lookup dialog automatically returns a list of Recently Viewed records if no search criteria is provided.  That will only help in this use case if the end user had been looking at the Contract.  There is no way to filter on the "MAX date".  However, if you had a "most recent" flag on the Contract record, then the filter could look at that field. The user still has to search for the contract, but then they would only see one result to select.
 

QUESTION: Can you add Validation Rules to a Group rather than just an individual User?

ANSWER: No. You can reference the User fields, Profile fields, and Role fields for the current user, but not the Group fields.
 

QUESTION: Can we use validation rules between the detailed and related lists, ie link sales team with opportunity stage?

ANSWER: No. You can write a validation rule on the Opportunity object that references fields on the Account, but not on the Account team. You can go up the relationship hierarchy, but not down.
 

QUESTION: Can a validation rule be overruled by a user?

ANSWER: No. However, you can write the validation rule to exclude specific Users, Profiles, or Roles. We demonstrated this in the Lookup Filters, but you can also do it in Validation Rules.
 

QUESTION: Is expansion of the "compiled size" on the road map?

ANSWER: Not at this time.
 

QUESTION: Will we be able to filter on opportunities soon?

ANSWER: Opportunities are not supported in the Summer '10 release and will not be added in the Winter '11 release, but we are in the process of prioritizing which additional objects to add in the next 3 releases. Please post/vote on IdeaExchange for supporting Opportunities. It helps for us to know which objects have the highest need.
 

QUESTION: Is it possible to have a lookup return all results, instead of just the recent ones?

ANSWER: We really really wanted to deliver this in Summer '10 but ran out of time, and it is not in the plan for Winter '11 due to other priorities. Definitely one to vote up on the IdeaExchange.
 

QUESTION: Are validation rules applied to web-to-lead or web-to-case forms that use the Salesforce fields?

ANSWER: Salesforce.com runs validation rules before creating records submitted via Web-to-Lead and Web-to-Case, and only creates records that have valid values.
 

QUESTION:  Is there a library or exchange of common validation rules we can leverage?

ANSWER:  Yes.  Search for Sample Validation Rules in the online help.
 

QUESTION: Can I validate email addresses?

ANSWER: Standard and Custom fields of type Email are automatically validated to make sure there are in a valid email format. However, we do not have a native callout to verify that it is a real email address.
 

QUESTION: I hear the new eclipse ide is released this week?

ANSWER: Yes, the new IDE was released and includes Lookup Filters.
 

QUESTION: What would happen if you have conflicting validation rules?

ANSWER: The end user would not be able to save the record.  This is why we always emphasize testing all of the possible scenarios when implementing validation rules.
 

QUESTION: Only 5 required per org?

ANSWER: The limit is 5 required filters per object, not org. There is no limit on optional filters. This limit is enforced to protect the performance for your end users and the overall service.
 

QUESTION: How do you get that new blue user interface skin? Is it available already?

ANSWER: The new skin is available and can be enabled by the admin. Go to Setup | App Setup | Customize | User Interface and click Enable New User Interface Themes.
 

QUESTION: How will existing data with invalid lookup data be handled once we add a new lookup filter?

ANSWER: The next time a user saves that record, they will see the error.
 

QUESTION: Can you do a cross object validation rule for objects that include visual force?

ANSWER: The validation rules run at the data model level, so they are not affected by the UI. Any record that is saved in Salesforce will run through the validation rules.
 

QUESTION: how do we base a rule after a opportunity reaches a certain stage?

ANSWER: There are samples in the "Examples of Validation Rules" online help topic. Check out the "Opportunity Management Validation Rules" section for ideas.


QUESTION: how would you write a rule to prevent saving a record based on the value of a picklist? Eg in opps field=direct or channel. IF channel is chosen it will not allow the saving of the record unless a partner is entered in the partner related list?

ANSWER: This is a common use case we refer to as "conditionally required". There is a sample in the "Examples of Validation Rules" online help, in section "Opportunity Management Validation Rules", titled "Conditionally-Required Field Based on Opportunity Stage".
 

QUESTION: Are there any plans to make the VLOOKUP function available in other places (like field update formulas or formula fields)?

ANSWER: This is on the product roadmap, but not in the plans for the next 3 releases. There is an IdeaExchange idea for it, so please add your vote.
 

QUESTION: On lookup filter for Contacts we'd like to filter the "Reports To" field to only those contacts on that Account, is this possible?

ANSWER: Yes. this will be possible in Summer '10 with Dependent Lookups.


QUESTION: Is it possible prevent the leads convertion using validation rules?

ANSWER: Yes.  However, validation rules are only enforced during lead conversion if "validation and triggers for lead conversion" are enabled in your organization (go to Setup | Customize | Leads | Settings).


QUESTION: Is there a book available for writing the validation and processing rules? Although the help in Salesforce is good I had to write a rule to calculate the amount of the profit to us based upon the value of another field. I am a programmer by trade it took me a while to figure this out.

ANSWER: We do not have a book specific to working with the formula language. We have sample validation rules, sample formula fields, and sample workflow rules in the online help -- these are meant to be a starting point. We also have a few examples in the Force.com Cookbook that are meant to be more advanced.


QUESTION: we have certain fields we only want to show when certain picklist values are chosen, other than dynamically updating a page, is there another way to accomplish this?

ANSWER: We refer to this as "Dynamic Page Layouts" or "Dependent Page Layouts" and it is a Top Idea. It is on the product roadmap, but not planned for the Summer '10 or Winter '11 releases.


QUESTION: can you create a filter on the account object and use it to display a list of values on a dependent object (in this case a child object hanging of the contact object)

ANSWER: No.  You can filter Contacts by Account, but not the Child Object records by Account.  The filtering can only reference fields that are on the record you are creating (I am assuming that the Account lookup is not on the Child Object record).


QUESTION: would there be standard filter examples available? Sort of similar to reports, either for reference or implementation.

ANSWER: Yes, in the online help, search for Lookup Filter Examples.


QUESTION: Can lookup filter be used against a value selected on another field? ie.when looking for contact, use Account selected on a task?

ANSWER: Yes, with Dependent Lookup Filters in Summer '10, a lookup filter can be used against a value selected on another field. However, lookup filters are not supported for Activities (Tasks and Events). Adding lookup filter support for Activities is on the product roadmap but not in the plans for the next 3 releases.
Mary ScottonMary Scotton
Matt BrownMatt Brown
Thanks @mscotton! 
Sys ADMINSys ADMIN
a great GREAT webinar.
thankyou.
Sys ADMINSys ADMIN
the links are broken.
can they please be updated
Becka DenteBecka Dente
Just found this, but this is a great FAQ for validation rules. Forwarding to some folks!
Vimal DesaiVimal Desai
I know it is a long time since this post came up but I am still eager to have a look at the webinar and the link seems to be broken. Can someone please assist me with modified recent link on the same webinar please?

Thanks!
Robert TompkinsRobert Tompkins
This some great info!