[SalesForce] Array of String values to get inserted into TextArea field

I am having a list of contact names in an array of String. I am trying to insert those names into a Text area field while inserting the record, but getting an error.
How can I implement this?

Is there any other way I can save those names in any different field type?

Best Answer

You would need to use a string join. For instance if you want the values to be new line delimited, you would do:

someRecord.TextAreaField__c = String.join(names, '\n');

You can of course change the delimiter to any character you wish.

Related Topic