You need to sign in to do that
Don't have an account?
Sanjana Rajasekar
Validation Rule Support
Hi , I have a usecase where If Sales Agreement record is edited, Its related Opportunity is Closed Won and Sales agreement type is 'New Business' . Should prevent users to add products.
I tried this, But this Validation throws message If it Creating Sales agreement record.
AND(
ISPICKVAL( SalesAgreement.Sales_Agreement_Type__c , 'New Business'),
ISPICKVAL( SalesAgreement.Opportunity__r.StageName ,'Won' ),
NOT(ISNEW()),
NOT(ISBLANK( PricebookEntry.Product2.Name ))
)
I tried this, But this Validation throws message If it Creating Sales agreement record.
AND(
ISPICKVAL( SalesAgreement.Sales_Agreement_Type__c , 'New Business'),
ISPICKVAL( SalesAgreement.Opportunity__r.StageName ,'Won' ),
NOT(ISNEW()),
NOT(ISBLANK( PricebookEntry.Product2.Name ))
)
To fix this issue, you can remove the condition that checks if the record is not new, and instead, add a condition to check if the record is being edited. Here's an updated validation rule that should work:
This validation rule will only trigger when a Sales Agreement record is being edited, its related Opportunity is "Closed Won", the Sales Agreement type is "New Business", and a product is being added to the Sales Agreement.
If this helps , please mark this as Best Answer.
Thank you.