You need to sign in to do that
Don't have an account?
NHameed
User exception with checkbox for Trigger
My Trigger
Need to create an excetion for User with "Commission_Admin__c" Box checked on User Record. So this trigger should not apply commission Admin. Please help. TIA
"Trigger OpptyTeamLock on OpportunityTeamMember (Before Insert,Before Delete){
set<Id> oppIdSet = new set<id>();
If(Trigger.IsBefore){
If(Trigger.IsInsert){
for(OpportunityTeamMember otm : trigger.new){
oppIdSet.add(otm.OpportunityId);
}
}
If(Trigger.IsDelete){
for(OpportunityTeamMember otm : trigger.old){
oppIdSet.add(otm.OpportunityId);
}
}
}
list<Opportunity>lstOpp = [select Id,Name,Opportunity_Team_Locked__c from opportunity where Id In :oppIdSet and Opportunity_Team_Locked__c = true];
If(Trigger.IsBefore){
If(Trigger.IsInsert){
for(OpportunityTeamMember otm : trigger.new){
if(lstOpp.Size()>0){
otm.AddError('Opportunity Team is locked. Contact Commission Team');
}
}
}
If(Trigger.IsDelete){
for(OpportunityTeamMember otm : trigger.old){
if(lstOpp.Size()>0){
otm.AddError('Opportunity Team is locked. Contact Commission Team');
}
}
}
}
}"
Need to create an excetion for User with "Commission_Admin__c" Box checked on User Record. So this trigger should not apply commission Admin. Please help. TIA
"Trigger OpptyTeamLock on OpportunityTeamMember (Before Insert,Before Delete){
set<Id> oppIdSet = new set<id>();
If(Trigger.IsBefore){
If(Trigger.IsInsert){
for(OpportunityTeamMember otm : trigger.new){
oppIdSet.add(otm.OpportunityId);
}
}
If(Trigger.IsDelete){
for(OpportunityTeamMember otm : trigger.old){
oppIdSet.add(otm.OpportunityId);
}
}
}
list<Opportunity>lstOpp = [select Id,Name,Opportunity_Team_Locked__c from opportunity where Id In :oppIdSet and Opportunity_Team_Locked__c = true];
If(Trigger.IsBefore){
If(Trigger.IsInsert){
for(OpportunityTeamMember otm : trigger.new){
if(lstOpp.Size()>0){
otm.AddError('Opportunity Team is locked. Contact Commission Team');
}
}
}
If(Trigger.IsDelete){
for(OpportunityTeamMember otm : trigger.old){
if(lstOpp.Size()>0){
otm.AddError('Opportunity Team is locked. Contact Commission Team');
}
}
}
}
}"
Can you try the below trigger.
If this solution helps, Please mark it as best answer.
Thanks,