+ Start a Discussion
sami amisami ami 

Get lead fields from task associated with lead



I am trying to get lead fields in to my task which is associated with lead.

I created a formula field and tried whoId(gets my lead)

whoid.email(error)   any idea on how to get that?


Kamatchi Devi SargunanathanKamatchi Devi Sargunanathan



You cannot achieve this through creating formula field. Because, whatID or whoID cannot be reffered in the formulas of activity fields.


To achieve storing the field value of leads in Task, you need to use 'whoID' and not whatid.


Try the following,


trigger leadfields on Task__c(before insert, before update){

  for(Task__c t : Trigger.New){

      List<Lead> leadList = [select id,name,field1__c,field2__c,field3__c from lead__c where id =: f.whoid];

      if(leadList.size() > 0){

           for(Lead l : leadList){

                  t.LeadField__c = l.field1__c;






Hope so this helps you...!

Please mark this answer a Solution and please give kudos by clicking on the star icon, if you found this answer as helpful.