You need to sign in to do that
Don't have an account?
Kelly Tetlock
Using ISNEW and ISCHANGED to make multiple fields mandatory
Hi,
I am very new to Salesforce and have been struggling with writing a validation rule for a week now and am getting nowhere fast! Essentially I want 3 fields to become required when data is entered into another field. When a new Contact is created and an Email address is added to the Contact I want a picklist that will capture the Source of the Email, a date field that will capture when the Email was obtained and a text field that will capture who obtained the Email to become mandatory. On a net new record the rule should only run if an Email address is added. To make matters even more difficult I will also have Contacts in my system that have been imported from a legacy CRM system. These Contacts may not have an existing Email address. I also want this rule to run if an Email is added to one of these existing records, or if the Email address on the existing record is changed and the three required fields I note above are blank.
I started out small with just the following. The appropriate error message does show, but when I choose a picklist value and try to save the error message won't go away and won't let me save the record.
AND
(OR(ISNEW(),(ISCHANGED(Email)),
ISBLANK(TEXT(Email_Source__c))
))
As I've mentioned, I'm very new to Salesforce and am still trying to understand how this validation function works. Any suggestions would be appreciated.
I am very new to Salesforce and have been struggling with writing a validation rule for a week now and am getting nowhere fast! Essentially I want 3 fields to become required when data is entered into another field. When a new Contact is created and an Email address is added to the Contact I want a picklist that will capture the Source of the Email, a date field that will capture when the Email was obtained and a text field that will capture who obtained the Email to become mandatory. On a net new record the rule should only run if an Email address is added. To make matters even more difficult I will also have Contacts in my system that have been imported from a legacy CRM system. These Contacts may not have an existing Email address. I also want this rule to run if an Email is added to one of these existing records, or if the Email address on the existing record is changed and the three required fields I note above are blank.
I started out small with just the following. The appropriate error message does show, but when I choose a picklist value and try to save the error message won't go away and won't let me save the record.
AND
(OR(ISNEW(),(ISCHANGED(Email)),
ISBLANK(TEXT(Email_Source__c))
))
As I've mentioned, I'm very new to Salesforce and am still trying to understand how this validation function works. Any suggestions would be appreciated.
I think the formula will look like below (I also included the ISCLONE(), in case the record is cloned). You probably also need to change the field names below since I don't know their real API names.
AND(
OR(ISNEW(), ISCLONE(), ISCHANGED(Email)),
NOT(ISBLANK(Email)),
OR(ISBLANK(Email_Source__c), ISBLANK(Email_Date__c), ISBLANK(Email_Person__c))
)
All Answers
You are telling it to throw the error if it is new, the email has been changed, or your field is blank. The and is doing nothing. I am assuming one of these items need to be moved to the AND possibly like this.
I think the formula will look like below (I also included the ISCLONE(), in case the record is cloned). You probably also need to change the field names below since I don't know their real API names.
AND(
OR(ISNEW(), ISCLONE(), ISCHANGED(Email)),
NOT(ISBLANK(Email)),
OR(ISBLANK(Email_Source__c), ISBLANK(Email_Date__c), ISBLANK(Email_Person__c))
)