+ Start a Discussion
Alaric WimerAlaric Wimer 

Need help with a Validation Rule

I have a custom checkbox field on Opportunity called “Same as Mailing Address?” that pulls the Accounts mailing address information (all custom fields) to the Opportunity’s custom “Project Address” fields when the user checks it. The issue I have is as follows:

1. The user tries to edit any of the Project Address, they should get a warning telling them that they must uncheck the “Same as Mailing Address?” checkbox before they can edit. I have been able to do this with validation rule BUT:


*** I also want the user to be able to reset the Project address to the Account mailing address by rechecking the checkbox if they want. The problem I’m having is that the validation rule also fires if the user tries to reset the Project Address details by rechecking the box because the box is checked and the address is being edited.

For Example:
1. User checks the “Same as Mailing Address?” box.

2. Project address custom fields are automatically mapped over after Save (via process builder).
2. User tries to edit the Project Address without unchecking the box: validation rule should fire telling them to uncheck the box first.
3. If a user unchecks the box, then edits the address, saves. And later decides to reset Project Address by rechecking the box, this needs to be successful. (right now my validation rule fires again because the address is trying to be changed with the box checked).


Does anyone know how I can get this to work?


Here’s my current validation rule:
Same_as_Mailing_Address__c = True &&
 (
    ISCHANGED(Project_Address__c) ||
    ISCHANGED(Project_City__c)  ||
    ISCHANGED(Project_State__c) ||
    ISCHANGED(Project_Zip_Code__c)
)