function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

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.


Ankit Arora

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


sample code


for (note Trinote : {      
        for(Opportunity opp: lstOpportunity){    
          List<Note> lstnote=[select Body,Title,ParentId,OwnerId,,SystemModstamp from note where ];                            
          for(integer i = 0; i < lstnote.Size(); i++) {   
          FeedItem fitem = new FeedItem();
          fitem.ParentId =;       
          fitem.Body =  + '\nOpportunity name :' +  
                        + '\nTitle :' + lstnote[i].Title
                        + '\nBody :'  + lstnote[i].Body
                        + '\nOwnerName :' + lstnote[i]                      
                        + '\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?


I am waiting for ur reply...