You need to sign in to do that
Don't have an account?
Yelena Glezer
Trigger on Lead is not populating the custom field
Trigger_Test__c is successfully updating, however the Account Owner Alias String is not - any idea what is the reason?
================================
//Class Logic
public with sharing class LeadTriggerHandler {
public LeadTriggerHandler() {
}
public void OnBeforeInsert(Lead[] Leads){
String companyName;
for (Lead newLead : Leads){
companyName = newLead.Company;
break;
}
for ( Account existingAccount : [select Id, Name from Account where Name =: companyName limit 1 ]){
//Leads[0].Company.addError('[Warning] Account exists.');
Leads[0].Trigger_Test__c=companyName;
Leads[0].Existing_Account_Owner__c= existingAccount.Account_Owner_Alias_string__c;
================================
//Class Logic
public with sharing class LeadTriggerHandler {
public LeadTriggerHandler() {
}
public void OnBeforeInsert(Lead[] Leads){
String companyName;
for (Lead newLead : Leads){
companyName = newLead.Company;
break;
}
for ( Account existingAccount : [select Id, Name from Account where Name =: companyName limit 1 ]){
//Leads[0].Company.addError('[Warning] Account exists.');
Leads[0].Trigger_Test__c=companyName;
Leads[0].Existing_Account_Owner__c= existingAccount.Account_Owner_Alias_string__c;
All Answers