-
Admin needs to preserve carriage returns in transfer of text fields in Salesforce
Hello developers,
I am working on an apex script to do a one time transfer of data from one object to another. One of the fields that has to be transferred is a large text area field. It will be transferred to a Rich text area field. I can't figure out how to preserve the carriage returns. Below is the simple version of my script that I have been using to try different things out. I know not to to put dmil inside of loops....again this is just a quick to find how to transfer the string. Without really understanding these different escape methods...I tried all of them...escapeEMCAScript, unescapeECMAScript, escapeHTML3 etc. But none of them work. Everything results in the string saved to the field without any returns.for(Project__c mp : [select Id, Brief__c, Opportunity__r.Description from Project__c
where Id = 'a10N0000001hF0WIAU'])
{
mp.Brief__c = mp.Opportunity__r.Description.escapeHtml4();
update mp;
}
Log In to reply.
Popular Salesforce Blogs

3 Rules that Trigger the right Actions for Salesforce– Pardot Engagement Studio Best Practices!
Engagement Studio is the next-generation lead nurturing tool of Pardot that enables you to effectively track and manage customer journeys throughout the campaign lifecycle. It…

Managed and Unmanaged packages in Salesforce in 2023 | All You Need to Know
What are the various types of packages in Salesforce? Let's understand! Unmanaged Package Think of it as a beautifully wrapped gift box that you can…

How Salesforce CPQ Enhances Your Sales Team’s Efficiency
In today's fast-paced business environment, efficiency and accuracy are paramount for sales success. Configure, Price, Quote (CPQ) software has emerged as a vital tool to…
Popular Salesforce Videos
15 Things You Didn’t Know About Salesforce
In this video we'll try to answer the following questions: What is Salesforce and why it is used? What is the job of Salesforce developer?…
How to Create a Landing Page in Salesforce Account Engagement (Pardot)?
A landing page acts as a customized doorstep for potential clients. It's crucial because it guides their focus toward a particular action, such as signing…
Salesforce Consultant or Salesforce Admin First? | Which is Better?
In this video, Kaelan Moss - Minute Admin briefs us on whether it's better to be a Salesforce admin or consultant first. Watch the video…