function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Steven YongSteven Yong 

Simple validation rule for opportunity page

Hi,

I would like to have a validation rule when a opportunity have product added that proposal got to have contact as well.
SonamSonam (Salesforce Developers) 
So are you saying that you wish to check the Account related to the opportunity has contact associated to it? is that what the requirement is?
justin_sfdcjustin_sfdc

Hi Steven,
I'd suggest you create a rollup formula to keep the count of opportunitylineitem. Once you have that, in your validation rule, you could say:

if(oppRollup__c > 0 && contact__c == null, true, false)

//Assuming that you have a contact field
 

Thanks!

Steven YongSteven Yong
Hi Sonam & justin_sfdc

I mean to say the contact role under opportunity page related list. Sorry for the confusion.