Skip to main content
Hi,

  Added below validation on a custom field in account not sure why this is getting fired when opportunity is created or updated. Please suggest me how to make this validation to fire only on a account. 

 NOT( REGEX( Email_Domain__c , "[a-zA-Z0-9.']+"))

Thanks

Sudhir
8 answers
  1. Jul 19, 2017, 11:20 AM

    We have ISCHANGED method in Saleforce which would return a TRUE if a particular field used on the ISCHANGED function has changed. Hence you can modify your Validation Rule as below -

    NOT(REGEX(Email_Domain__c, "[a-zA-Z0-9.']+")) && ISCHANGED(Email_Domain__c)

    This validation rule would only fire if the

    Email_Domain__c was changed and changed to an unacceptable value. Now the Validation Rule will not fire as the trigger is trying to update the Support_Email__c  field and not the Email_Domain__c field on Account.

    Feel free to get back to me if you have any doubts.
0/9000