You need to sign in to do that
Don't have an account?
vodnura
Update field using trigger
I am trying out to implement a trigger, which will auto fill lookup fields based on a prticular field. Here is my code. can achieve this using workflow but wanted to know how it works with trigger.
trigger trigger2 on Opportunity (before insert,before update) {
for(Opportunity Oppp : trigger.new){
if(Oppp.Recruiter__c =='A') // lookup field
{
Oppp.Director__c = 'B'; //lookup field
}
}
}
Thanks-
VODNURA
I assume that Oppp.Recruiter__c and Director__c are your lookup fields. If so, note that they contains an Id value, not a String value like the name of the record you're looking up to. So you'll need to compare them to some other Id field, or store an Id value in them, not a String value.
Hopefully, that will help you get started with your trigger. If not, please post more details, including your modified code.