+ Start a Discussion
Rana RoyRana Roy 

How to store the names of Contacts into Accounts?

Is there any way to store the List of Contacts on some Field of Account?

Suppose there is a Text Area Long Field on Account where I want to store the names of all the contacts for the account.
How to do that?
Best Answer chosen by Rana Roy
Hi Rana,

Try this trigger on contact
trigger Devcomcn3 on Contact (after insert) {
    list <id> ids = new list<id>();
    for(contact c : trigger.new){
    list<account> accounts = [select id,name,conts2__c from account where id in :ids];
    list<account> AccountsToUpdate = new list<account>();
    for(account a : accounts){
        for(contact c : trigger.new){
            if(c.accountid == a.id){
                a.conts2__c +=c.lastname;
    update AccountsToUpdate;

Let me know if you have any issues.
Mark it as best answer if it works.