Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Changing to token to camelcase

daver37819942
Level 3
Level 3

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?

 

1 Accepted Solution
DavidKangni
Correct answer by
Community Advisor
Community Advisor

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

View solution in original post

2 Replies
DavidKangni
Correct answer by
Community Advisor
Community Advisor

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

View solution in original post

daver37819942
Level 3
Level 3
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
Level 3
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.