You need to sign in to do that
Don't have an account?
Pavan 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?
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);
}
}
}
}