You need to sign in to do that
Don't have an account?
Throw an Error along with the error record
I want to show an error that already a record is made primary. 'Please uncehck primary on test11 record'
You need to sign in to do that
Don't have an account?
I want to show an error that already a record is made primary. 'Please uncehck primary on test11 record'
Hi,
Try below code...
trigger testtrig1 on Test1__c (before insert) {
Test1__c t=trigger.new[0];
if(t.primary__c == true){
Test1__c t1= [Select id,Name,Primary__c from Test1__c where Primary__c = true];
t.AddError('Please uncehck primary on'+' '+ t1.name +' '+'record');
}
}
All Answers
Hi,
Try below code...
trigger testtrig1 on Test1__c (before insert) {
Test1__c t=trigger.new[0];
if(t.primary__c == true){
Test1__c t1= [Select id,Name,Primary__c from Test1__c where Primary__c = true];
t.AddError('Please uncehck primary on'+' '+ t1.name +' '+'record');
}
}