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
Liubov KornevaLiubov Korneva 

Trigger Needed

I have an assignment. I have multiple record types 9and page layouts) for opportunity stages. The assignment is to create a trigger that will prevent users from moving into another stage if Primary Contact role on the Opportunity is not entered. Please help

Thank you, 

Best Answer chosen by Liubov Korneva
Cyrus TalladenCyrus Talladen
For this task I would implement a before update trigger which checks if that Primary Contact field is null.  If that field is null then we show a system message 

update myObj; 
} catch(Exception exc) {   if(Primary_Contact__c == null) {[0].addError('Please make a selection'); 

then override the save or next button with this functionality

Cyrus T