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
sumit dsumit d 

validation rule on opportunity

Hi All,
 i need Validation Rule For all open opportunities that do not have a contact role entered that it must be entered before updating the opportunity .
how to do this?
Any suggestions?
kamala swarnalathakamala swarnalatha
Hi,

Can you please explain requirement briefly?

Thanks,
K.Kamala,
Sweet Potato Tec.
sumit dsumit d
A validation rule for All open opportunities(not closedWon && ClosedLost)
if thier Contact role is blank than there should be error before updating the opportunity that ContactRole must be entered.
kamala swarnalathakamala swarnalatha
Hi,

Try this one,

AND( ISPICKVAL( StageName , "Closed Won")), ISPICKVAL( StageName , "Closed Lost")),(ISBLANK(ContactRole)))

Hope this helps!

Thanks,
K.Kamala,
Sweet Potato Tec.
 
kamala swarnalathakamala swarnalatha
Sorry

try this

AND( ISPICKVAL( StageName , "Closed Won")), ISPICKVAL( StageName , "Closed Lost")),(ISBLANK(ContactRole_c)))
sumit dsumit d
ContactRole is a relatedList not a field
kamala swarnalathakamala swarnalatha
Hi,

Is this with Relationship with contact role.

 
sumit dsumit d
yes,Opportunity has a relatedList called ContactRole and this relatedList must have Value
kamala swarnalathakamala swarnalatha
Hi,

May I know the object name and the field because field is ContactRole or object is ContactRole.
sumit dsumit d
 object is ContactRole. Opportunity Contact Role represents the role of Contact/Person account on an Opportunity. There is many-to-many relationship between Opportunity and Contact, through a junction object called OpportunityContactRole
kamala swarnalathakamala swarnalatha
Hi,

You can create custom formula fields(ContactRoleOpportunitity_c) on the junction object that contain the values from the related record then create the validation rule like this

AND( ISPICKVAL( StageName , "Closed Won")), ISPICKVAL( StageName , "Closed Lost")),(ISBLANK(OpportunityContactRole.ContactRoleOpportunitity_c)))

Hope this helps!

Thanks,
K.Kamala,
Sweet Potato Tec.
sumit dsumit d
its showing  Error: Syntax error. Extra ','
kamala swarnalathakamala swarnalatha
Hi,

Will you please remove the bracket before the isblank and  at  the end of it.

Thanks
Ajay K DubediAjay K Dubedi
Hi Sumit,

Please Try this validation rule:-
 
AND( ISPICKVAL( StageName , "Closed Won"), ISPICKVAL( StageName , "Closed Lost"),(ISBLANK(OpportunityContactRole.ContactRoleOpportunitity_c)))

Please mark as best answer if it helps you.

Thank You
Ajay Dubedi