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
Pavan VadlamudiPavan Vadlamudi 

How to get Account realated contactemail ,firstname etc details in workflow.Is there any way to get in formula ?

I need to get the whoid related details like email,lastname etc in workflow outbound message.Can you pleas let me know if there is any way to get throgh formula.else do we need to go for trigger?
Pavan VadlamudiPavan Vadlamudi
Can any one help me that my code is not updating the activities custom fields salesforce
Public with sharing class TaskTriggerClass{
    
    public void updateTaskFields(List<Task> newTasklist,List<Task> oldTaskList){
         Set<Id> taskContactIds = new Set<Id>();
          Map<Id, Contact> taskWhoidMap = new Map<Id, Contact>();
       
      for (Integer i = 0; i < newTasklist.size(); i++) {       
            if(newTasklist[i].whoid!=null)
            {
            //adding contact/whoIds's to set
                taskContactIds.add(newTasklist[i].WhoId);  
                system.debug('1111111111111' +taskContactIds.size());
            }           
        }
        //get the contacts /who id's from contact
      taskWhoidMap= new Map<Id, Contact>([select id ,Name,Email from contact where Id IN:taskContactIds]);     
       for(Task tk :[select id ,subject,whoId,whatId,Contact_Name__c from task where whoid IN:taskContactIds AND WhoId!=null]){  
            system.debug('2222222222222' +tk.Contact_Name__c);
            if(taskWhoidMap.containsKey(tk.WhoId)){
                 contact c = taskWhoidMap.get(tk.whoId);
                   tk.Contact_Name__c=taskWhoidMap.get(tk.whoId).Name;
                 system.debug('3333333333' +tk.Contact_Name__c);
            }
          }

}
}
Pavan VadlamudiPavan Vadlamudi
Everything is coming correctky in logs but trigger (beofre insert and before update ) is not updating the fields