You need to sign in to do that
Don't have an account?
raju p 4
i have little doubt i aim created chiled to parent record in trigger its not working
public class WhenyouCreateContactCreateAccount {
public static void CreateAccount(list<contact>cons){
set<id>ids= new set<id>();
list<account>acc= new list<account>();
for(contact c:cons){
ids.add(c.AccountId);
acc=[select name,phone from account where id IN:ids];
for(account a:acc){
a.Name=c.Name;
a.Phone=c.phone;
}
insert acc;
}
}}
trigger WhenyouCreateContactCreateAccount on Contact (after insert,after update) {
WhenyouCreateContactCreateAccount.CreateAccount(trigger.new);
}
please do the needful, where i am doing wrong
public static void CreateAccount(list<contact>cons){
set<id>ids= new set<id>();
list<account>acc= new list<account>();
for(contact c:cons){
ids.add(c.AccountId);
acc=[select name,phone from account where id IN:ids];
for(account a:acc){
a.Name=c.Name;
a.Phone=c.phone;
}
insert acc;
}
}}
trigger WhenyouCreateContactCreateAccount on Contact (after insert,after update) {
WhenyouCreateContactCreateAccount.CreateAccount(trigger.new);
}
please do the needful, where i am doing wrong
Arvind Kumar,
Not working code, i tryied many ways this one also
Did get your required solution?
If not, please let me know your exact requirement.So that i can help you and give a better solution.
Thanks,
Arvind Kumar