Account Validation Rules - Answers - Salesforce Trailblazer Community
Trailblazer Community
Ask Search:
Casey BrandonCasey Brandon 

Account Validation Rules

Hello,

We have created a new validation rule on the account object to ensure billing addresss is populated: 
"OR(
ISBLANK(BillingStreet),
ISBLANK(BillingCity),
ISBLANK(BillingState),
ISBLANK(BillingPostalCode),
ISBLANK(BillingCountry)
)"

However, now when users go to create or update opportunities on old accounts, the validation rule  is firing on the opportunity page. Is this supposed to happen due to the relationship between Opportunity and Account?
Best Answer chosen by Kermit (salesforce.com) 
Seyran MammadovSeyran Mammadov
I remember doing something similar with regards to Address fields on Accounts and it would fire validation rules whenever I was attempting to create opportunities. 

I think the Roll-up summary fields are most likely the cause of this since they get updated and calculated whenever an Opportunity is added. Then, if the Account is missing the billing address, Salesforce doesn't want to save it since it's not meeting the validation rule. 

Validation rules are retroactive in that sense. They would fire on accounts created before the validation rule was introduced if you attempt to edit them.
 

All Answers

Seyran MammadovSeyran Mammadov
Hi Casey,

I can think of two things:

---Roll-up summary field on Account that invokes an Account update
---Triggers/rules on Opportunity that may invoke an Account update
Casey BrandonCasey Brandon
We have a few roll-up summary fields on the Account SUM/COUNT on related Opportunties. Would this be the source of the problem?
Seyran MammadovSeyran Mammadov
I remember doing something similar with regards to Address fields on Accounts and it would fire validation rules whenever I was attempting to create opportunities. 

I think the Roll-up summary fields are most likely the cause of this since they get updated and calculated whenever an Opportunity is added. Then, if the Account is missing the billing address, Salesforce doesn't want to save it since it's not meeting the validation rule. 

Validation rules are retroactive in that sense. They would fire on accounts created before the validation rule was introduced if you attempt to edit them.
 
This was selected as the best answer
Casey BrandonCasey Brandon
I think you are right. That makes sense. Thanks so much for your help!
Seyran MammadovSeyran Mammadov
My pleasure!