You need to sign in to do that
Don't have an account?
Ajitkumar Pradhan 9
Trigger Check(Correct or not)
trigger trigMapFields on Lead (before update) {
Map<Home_Phone,String> leadHome = new Map<Home_Phone,String>(); // Map of the converted Contact phone and the Lead phone
for(Lead lead : Trigger.new) {
if (lead.IsConverted) {
leadStatus.put(lead.ConvertedContactHome_Phone,lead.Home_Phone);
}
}
List<Contact> conContacts = [select Phone from Contact WHERE Contact.Home_Phone IN :leadHome.keySet()];
for ( Contact c : conContacts) {
c.Phone = leadHome.set(Home_Phone);
}
update conContacts;
}
is this the correct trigger? can anyone correct me if i am wrong?
Map<Home_Phone,String> leadHome = new Map<Home_Phone,String>(); // Map of the converted Contact phone and the Lead phone
for(Lead lead : Trigger.new) {
if (lead.IsConverted) {
leadStatus.put(lead.ConvertedContactHome_Phone,lead.Home_Phone);
}
}
List<Contact> conContacts = [select Phone from Contact WHERE Contact.Home_Phone IN :leadHome.keySet()];
for ( Contact c : conContacts) {
c.Phone = leadHome.set(Home_Phone);
}
update conContacts;
}
is this the correct trigger? can anyone correct me if i am wrong?
Please check once following code.
Note: I have not tested above code.please let me know in case of any issues.
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
All Answers
Your trigger is wrong.Please let me know your requirement clearly.So that we can help you.
Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
I have a custom field Home Phone both in Lead and Contact. But when lead is converted Lead Home_Phone should be saved in standard Field Phone of Contact.
Could you help me to write a trigger,
Please check once following code.
Note: I have not tested above code.please let me know in case of any issues.
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Thanks
Varaprasad
@For Support: varaprasad4sfdc@gmail.com
Thanks for the code.
What will be the test class for this.
Regards,
Ajit