+ Start a Discussion
vibrationvibration 

i want to store collection of datas into single item.

I have 5 data in one object,

 

sno  sname

1        smith

2        vincent

3        lee

4        lawson

5        prem

 

i query a all the data in list. i want to display all the datas into single item. which function is used? how is used ?plz send sample code.

 

Expected result:

1        smith  2        vincent  3        lee  4        lawson 5        prem( all are in one data in other objects)

Ankit AroraAnkit Arora

Please let me know where you will use this single line data? I will send you the code for it.

 

Thanks
Ankit Arora
vibrationvibration

in chatter, i will show all the data in one chatter feed. but it created 5 feeds.

 

sample code

 

for (note Trinote : Trigger.new) {      
        for(Opportunity opp: lstOpportunity){    
          List<Note> lstnote=[select Body,Title,ParentId,OwnerId,Owner.name,SystemModstamp from note where ParentId=:Opp.id ];                            
          for(integer i = 0; i < lstnote.Size(); i++) {   
          FeedItem fitem = new FeedItem();
          fitem.ParentId = opp.id;       
          fitem.Body =  + '\nOpportunity name :' + opp.name  
                        + '\nTitle :' + lstnote[i].Title
                        + '\nBody :'  + lstnote[i].Body
                        + '\nOwnerName :' + lstnote[i].Owner.name                      
                        + '\nDate of Creation:' + lstnote[i].SystemModstamp;
                       
          feedItems.add(fitem) ;              
                                     
           }

 if (feedItems.size() > 0) {
        Database.insert(feedItems,false); //notice the false value. This will allow some to fail if Chatter isn't available on that object
    }

 

This code is  insert 6 records for 6 chatter feed. i want to insert all the record in to1 chatter feed. How its work?

vibrationvibration

I am waiting for ur reply...