Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

Ampersand in field while saved set & then why & until too large for update

Asked by Anne Bell Apr 22, 2021 306 views 1 answer
Share

About this question

My question is, some records contains "&" in fields (or accents). They have to. Those fields are automatically updated and used as mapping values, so I cannot really control them. When record is saved, "&" become "&". Then record is updated and value become "&". Then "&" and so on ... Correct them manyally will just do the same. It's causing me 2 problems :my values get false (and this value is used for mapping)at some point the value is getting too large and update fails.  Example : a record with "Johns & Johns", automatically created. If a lead is created with "Johns & Johns", some apex code should value a lookup with this record. But when I save it, value becomes "Johns & Johns". Then "Johns & Johns".Same  hing with accents that are registered with html values "é" then "é" and so on.


Edit 2019-11-15 Since it could be some trigger code, i searched and found this function, the only on used on those field
public static String specialCharHandler(String f){ String str = f.escapeHtml4(); system.debug('str::-->>' + str); str = str.replace(' ',' '); system.debug('str22::-->>' + str); return str; }

Ok, i made some tests and this is the cause of the behavior. Thanks cropredy for helping me understand the problem.  How to use ampersands & Would have vote for your comment if it was an answer ;)

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.