In my "leads" tab I input all the address, phone #, name. Then when I go down and make a " new task" for that "lead" in the task section the name , phone #, and e-mail are already populated I would like to have the address populate there as well.
Thanks i still am trying to understand it. Are there any books that could help me I still don't understand on how to create a trigger to make this action happen. thank you for your help
what is your scenario. It would be great if you can clearly mention that,
In my "leads" tab I input all the address, phone #, name. Then when I go down and make a " new task" for that "lead" in the task section the name , phone #, and e-mail are already populated I would like to have the address populate there as well.
Thank you for Helping
Alex
Yes - you'd want a before insert task trigger that adds the address either to the beginning or the end of the Description
Thanks i still am trying to understand it. Are there any books that could help me I still don't understand on how to create a trigger to make this action happen. thank you for your help
http://wiki.developerforce.com/index.php/An_Introduction_to_Apex
Here's my quick bad syntx version so you have a sense for what it might looks like:
trigger addAddres on task (before insert){
Set<id> leadIds=new Set<Id>();
for (Task t: trigger.new){
if(t.WhoId!=Null){
if(t.WhoId.startsWith('00Q')){//All lead Id's start with 00Q
leadIds.add(t.WhoId);
}
}
}
List<Lead> leads=[Select State, PostalCode, Id FROM Lead WHERE Id IN:leadIds];
For (Task t2:trigger.new){
for(Lead l:leads){//note this coudl be more efficient, but i left as is for ease of reading
if (l.Id==t2.WhoId){
t2.Description+=l.State+l.PostalCode;
}
}
}
Thank you very much now I will now knowledge myself on where to place this and learn a new language.
thank you!!!
Alex
C