You need to sign in to do that
Don't have an account?
SATZ
Record type selection
Hi all,
I am using EDUCATION custom object In education contact is master detail object.
Education has two record types namely Phase and A la Carte
For each contact I create education In both record type.
In both records type I want one only record must be insert
in Phase==1 and A la carte==1
for this how to write condition in trigger on Education
regards satz
Hi,
Try the below code snippet as reference:
trigger chkrecordcount on education__c (before insert)
{
integer count=[select count() from education__c where contactid=trigger.new[0].contactid and RecordTypeId=Trigger.new[0].RecordTypeId];
if(count>0)
{
trigger.new[0].addError('you coannot insert this record ');
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
All Answers
Hi,
Try the below code snippet as reference:
trigger chkrecordcount on education__c (before insert)
{
integer count=[select count() from education__c where contactid=trigger.new[0].contactid and RecordTypeId=Trigger.new[0].RecordTypeId];
if(count>0)
{
trigger.new[0].addError('you coannot insert this record ');
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
Thanks for Your reply,
its working fine.
thanks a lots..