Save List data into Long Text Area

Save List data into Long Text Area



Simple displaying of the data using a String concatenation to save wanted data into a Long text area Field in Salesforce

Wrong display format (displays only 10 elements with dots):


list<String> st= new List<String>();

Ipl__A__c cc = new Ipl__A__c();
cc.Longtextarea__c = st;

insert cc;


Directly assigning a list to the long text area field shows only first 10 elements. So in order to overcome this, you need to iterate through the list and apply string concatenation to store the string in the Long text area field. Sample code below : (displays all the list elements)









Apex Code:

list<String> st= new List<String>();

for(integer i = 0 ; i <=10000;i++){
    st.add('String : ' + i + ',');
}

String mystring = '';
for(String sss : st){
    mystring += sss + ',' ;
}
Ipl__A__c cc = new Ipl__A__c();
cc.Longtextarea__c = mystring;

insert cc;




We need your support,Please share/Like us on Facebook ⛅
Save List data into Long Text Area Save List data into Long Text Area Reviewed by dasfrogpractice on 22:28 Rating: 5

No comments:

Theme images by mariusFM77. Powered by Blogger.
Youtube Channel Image
Dasfrog Subscribe To watch more Salesforce Training
Subscribe