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
pabramspabrams 

remove linebreak from Lead field

i have a lead field which might have linebreak needs to be removed we were doing this via trigger 
  1. l.Last_Interesting_Moment_Desc__c = l.Last_Interesting_Moment_Desc__c.replaceAll('\r\n', ' ');

since customer is having some issue with trigger we removed trigger 
and used SUBSTITUTE
2. 
SUBSTITUTE(mkto_si__Last_Interesting_Moment_Desc__c,SUBSTITUTE($Label.mkto_si__linebreak, "-", "")," ")
but this has the known issue with salesforce which is appending HL_ENCODED_ and HL_BLANK_
any other hacks to acheive this?






 
Deepali KulshresthaDeepali Kulshrestha
Hi,

I've gone through your requirement and you can see the example of how to remove the line break from a field:

Example-->

You should do this change on your Lead trigger, that use replace('\n','') and then store it to the field.

1.String yourValue=l.Last_Interesting_Moment_Desc__c;

2.L.Last_Interesting_Moment_Desc__c=yourValue.replace('\n','');



I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com
pabramspabrams
@deepali
we already have the lead trigger since customer is having issue with trigger on migrating large  data we want to remove the trigger.

looking for anyother approach to fix apart from trigger