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
Dhilip DussaDhilip Dussa 

update field

Hi all,

I have one field called address(Textarea long) if i gave address in second line need to auto populate in firstline with comma separated

And if anyone gave # in second line need to remove

Example 
Address: orus
                us.
Output:orus,us
Thanks
Khan AnasKhan Anas (Salesforce Developers) 
Hi Dhilip,

Greetings to you!

Please refer to the below links with a similar discussion which might help you further with the above requirement.

https://success.salesforce.com/answers?id=90630000000DNcNAAW

https://developer.salesforce.com/forums/?id=906F000000093xGIAQ

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas
Raj VakatiRaj Vakati


you need to use the before insert ,before update trigger .. 

Split the text based on the new line ie.\n .. and update it with comma separated and append it ..

 
String myString = '345 Shoreline Park\nMountain View, CA 94043\nUSA';
System.debug(myString);
String singleLineVersion = myString.replaceAll('\\n', ', ');
System.debug(singleLineVersion);