Set Lead Source and Fields for Healthcare Industry

This trigger updates specific fields (Lead Source, SIC Code, and Primary) for Leads in the Healthcare industry when their records are updated. It enforces industry-specific field values and improves data consistency.

For more practice scenarios, explore this YouTube playlist.

Solution:

trigger LeadTrigger on Lead (before update) {
       if(Trigger.isBefore && Trigger.isUpdate) {
              for (Lead leadRec : Trigger.NEW) {
                  leadRec.Status=’Working-Contacted’;
                  if (leadRec.Industry == ‘Healthcare’) {
                         leadRec.LeadSource = ‘Purchased List’;
                         leadRec.SICCode__c = ‘1100’;
                         leadRec. Primary__c = ‘Yes’;
                  }
            }
       }
  }

Want to Apply As Content Writer?

Leave a Comment

Your email address will not be published. Required fields are marked *

Shopping Cart

Let's get you started!

Interested in writing Salesforce Content?

Fill in this form and we will get in touch with you :)