+ Start a Discussion
Devendra Hirulkar 3Devendra Hirulkar 3 

how to add multiple record on single object

hello friends,
i have two object sub and account when i add data on sub  object like (product name which is a filed in sub) it automatically added that data to account in field product name  but when i added data on same account it replace the previous one and inserted the new one but i want both data previous and new inserted so how can i do this 
like first product name is gold and when i add another product name like silver then in my work it display like  both gold, siver that i have inserted old one and new 
 here is my trigger 

trigger copypro  on Subsc__c  (after insert,after update) 
    //Id recordTypeId = [Select Id From RecordType Where DeveloperName = 'User Group Membership'].Id;
    Id recordTypeId = Schema.SObjectType.Subsc__c.getRecordTypeInfosByName().get('User Group Membership').getRecordTypeId();

    List<Subsc__c> subscList = new List<Subsc__c>();

    for (Subsc__c s : Trigger.new){
        if(s.RecordTypeId == recordTypeId)

    Map<ID, Account> Acc = new Map<ID, Account>(); //Making it a map instead of list for easier lookup
    List<Id> listIds = new List<Id>();        
    set<ID>cObjectID = new set<ID>();   //Making a set of Product ID's
    Map<ID, Account> updateMap = new Map<ID, Account>();
    for (Subsc__c s : subscList)
        if(s.Product__c     != null)
            cObjectID.add(s.Product__c    );//takes the Lookup Record & Add that ID's in cObjectID set
        Map<ID,Product2> cObjectMap = new Map<ID,Product2>([select Id,Name from Product2 where Id IN: cObjectID]);
        Acc = new Map<Id, Account>([SELECT id, Product_Name__c,(SELECT ID,Product__c FROM Subscs__r) FROM Account WHERE ID IN :listIds]);
        for(Subsc__c s : subscList)
            if(cObjectMap.get(s.Product__c    ).Name != Null)
                // fill the country name on Opportunity with Country Name on Country_Object__c
                String pro= cObjectMap.get(s.Product__c    ).Name;
                Account myacc = acc.get(s.Company_Name__c);
                if(myacc != null){ //always check for nulls to avoid null pointer exceptions
                    myacc.Product_Name__c =pro;
        update updateMap.values();

please let me know as soon as possible
You can use multi select picklist in such a case but it is for limited and static items