Changing to token to camelcase | Community
Skip to main content
daver37819942
Level 3
May 17, 2021
Solved

Changing to token to camelcase

  • May 17, 2021
  • 2 replies
  • 2149 views

How does one update to use camelcase in standard using out of box updating html?

<td style="padding-top:10px;padding-bottom:20px;padding-left:10px;font-size:18px;color:#394f67;vertical-align:top;line-height:24px;"><span style="padding-top:10px;padding-bottom:10px;padding-left:10px;font-size:18px;color:#394f67;vertical-align:top;line-height:24px;">Hello, <span class="acr-field nl-dce-field" data-nl-expr="/context/rtEvent/ctx/recipientFirstName" data-nl-type="string" contenteditable="false">Guest First Name (recipientFirstName)</span>!<br>
<br>
Welcome! xxxx xxxxx xxxx xxxx!</span></td>

 

If recipientFirstName comes in all caps or lowers, can this be adjust to camelcase inside html?

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by DavidKangni

Create a perso block like below and call it in your email

function toSmartCase(context.profile.firstName) { var strLower = str.toLowerCase(context.profile.firstName); var nChar = strLower.length; for (var i=0; i < nChar; i++) if ( i == 0 || strLower.charAt(i-1) == ' ' || strLower.charAt(i-1) == '-' ) strLower = strLower.substring(0, i) + strLower.charAt(i).toUpperCase() + strLower.substring(i+1); return strLower; }

Thanks,

David

2 replies

DavidKangni
Community Advisor
DavidKangniCommunity AdvisorAccepted solution
Community Advisor
May 18, 2021

Create a perso block like below and call it in your email

function toSmartCase(context.profile.firstName) { var strLower = str.toLowerCase(context.profile.firstName); var nChar = strLower.length; for (var i=0; i < nChar; i++) if ( i == 0 || strLower.charAt(i-1) == ' ' || strLower.charAt(i-1) == '-' ) strLower = strLower.substring(0, i) + strLower.charAt(i).toUpperCase() + strLower.substring(i+1); return strLower; }

Thanks,

David

David Kangni
daver37819942
Level 3
May 18, 2021
IS this doable not sure of what JS functions we can use? UPDATE data-nl-expr="/context/rtEvent/ctx/recipientFirstName" to data-nl-expr="context.rtEvent.ctx.recipientFirstName.toTitleCase()" ? This works if want to lowercase data-nl-expr="context.rtEvent.ctx.recipientFirstName.toLowerCase()"
daver37819942
Level 3
May 25, 2021
NO the solution Did not work. Trying to titlecase or propcase but NO one can not change in ACS. Seems to be a very limited in what one can do.