Apex Trigger on lead: when Lead is created and updated with LeadSource as Email then give rating as Hot #inSalesforce

Apex Trigger on lead: when Lead is created and updated with LeadSource as Email then give rating as Hot #inSalesforce


trigger emailRatingHot on Lead (before insert, before update) {
    for (Lead lead : Trigger.new) {
        if (lead.LeadSource == 'Email') {
            lead.Rating = 'Hot';
        }
    }
}

Comments