You need to sign in to do that
Don't have an account?
Craig Coulter
Validation rules for new records
Hi all,
I have a custom object under opportunity and I want to prevent new records from being created if 1 already exists, this is what I have so far:
AND(ISNEW(), Opportunity__r.Of_Campaign_Reviews__c >= 1,
OR(Opportunity__r.Performance_Status__c <> "Amber",Opportunity__r.Performance_Status__c <> "Under"), OR(Opportunity__r.Days_Since_Last_Campaign_Review__c = NULL, Opportunity__r.Days_Since_Last_Campaign_Review__c <= 7), OR(Performance_percentage_on_creation__c >= 0.80, Opportunity__r.Performance_Percentage__c >= 0.80))
The first rule works fine if the record is not marked as completed, but the others don't seem to work as new records can be created within 7 days of the last one, or the performance status is notunder or amber etc.
What do I need to do to fix it?
Thanks
Craig
I have a custom object under opportunity and I want to prevent new records from being created if 1 already exists, this is what I have so far:
AND(ISNEW(), Opportunity__r.Of_Campaign_Reviews__c >= 1,
OR(Opportunity__r.Performance_Status__c <> "Amber",Opportunity__r.Performance_Status__c <> "Under"), OR(Opportunity__r.Days_Since_Last_Campaign_Review__c = NULL, Opportunity__r.Days_Since_Last_Campaign_Review__c <= 7), OR(Performance_percentage_on_creation__c >= 0.80, Opportunity__r.Performance_Percentage__c >= 0.80))
The first rule works fine if the record is not marked as completed, but the others don't seem to work as new records can be created within 7 days of the last one, or the performance status is notunder or amber etc.
What do I need to do to fix it?
Thanks
Craig
Can you try with below validation rule and let me know further :
If it helps , please mark this as Best Answer.
Thank you.
Please correct me if I am wrong, but here what is your requirement is, you want the validation execute
- For New Record and
- Performance Status equal to either Amber or Under or Days since last campaign review > 7
Can you tell me what is with the percentagesHi Craig,
Please try the following updated rule:-
If you find this helpful, please mark it as best answer.
Thanks.
Unfortunately, both examples allow a new record to still be created when there is already an active record within 7 days and has not got a performance status of either Amber or Under.
@Abdul, yes, the validation should show the error if a new record is created when there is already one active with the last 7 days, has not got the performance status or either Amber or Under. The percentages were added as an experiment as they are what determines the Performance Status, so anything over 80% will be on target and not require looking at.