+ Start a Discussion
Prasanth RPrasanth R 

When a user changes to closed won in a opportunity record, they will not be able to save it until they have added at least one related contact record . is it possible in validation rule ?

veer soniveer soni
hi Prasanth,
you can't achieve this by validation rule. if you want then you have to write a trigger on opportunity object  before update and you can fire addError message when if there is no record of contact in opportunity object.

don't forget to mark it as best answer if it helps you.
Thank you
CharuDuttCharuDutt
Hii Prasanth
Try Below Trigger
You Can Try Validation Rule Also
AND(ISPICKVAL(STAGENAME,'Closed Won'),ISBLANK(Contact__c))
-------------------------------------------------------------------------------------------------------------------
trigger testtrigger on oppotunity (Before Update){
	if(trigger.IsBefore && trigger.IsUpdate){
	for(opportunity opp : trigger.new){
	if(opp.StageName == 'Closed Won' && qte2.StageName != Trigger.oldMap.get(Opp.Id).StageName && Opp.Contact__c == Null){
			opp.AddError('Please Add Atleast One Contact');
			}
		}
	}
}
Please Mark It As Best Answer If It Helps
Thank You! 
Suraj Tripathi 47Suraj Tripathi 47

Hi,

You can use the validation rule as the below.

AND(ISPICKVAL(STAGENAME,'Closed Won'),ISBLANK(Contact__c))

Thank You

Prasanth RPrasanth R
contact is a standard object...why you have to use contact__c?
 
CharuDuttCharuDutt
Hii Prasanth
If There's  Already Contact Lookup You Can Use ConatctId If Not And You've Made Contact Lookup It Should Be Contact__c 

Please Close Your Query By Marking It As Best Answer If It Helps So It Helps Others In Future Also
Thank You!