function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sfdc development hintssfdc development hints 

cananyone helpme writing a trigger for the below condn plzz

2.1.2.Updating the value of the new field Chnnel in Account object       
    The value of the Channel field will be populated based on the Account Profile's field Chemist type. 
     If the Chemist type is blank then the Channel will be "Doctor" else it will be "Pharmacy"   



Best Answer chosen by Admin (Salesforce Developers) 
RajiRaji

 

Please try the following Code
trigger popultateData on Account (before update) {
    string accid;
    for(Account objA:trigger.new){
        if(objA.Chemisttype__c  == null ){
            objA.channel__c =  'Doctor';
        }else {
            objA.channel__c = 'Pharmacy';
        }
    }
}

 Regards,

Vnath