+ Start a Discussion
sumit suwalkasumit suwalka 

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 suwalkasumit suwalka
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 suwalkasumit suwalka
ContactRole is a relatedList not a field
kamala swarnalathakamala swarnalatha
Hi,

Is this with Relationship with contact role.

 
sumit suwalkasumit suwalka
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 suwalkasumit suwalka
 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 suwalkasumit suwalka
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