Expand my Community achievements bar.

We are excited to introduce our latest innovation to enhance the Adobe Campaign user experience — the Adobe Campaign v8 Web User Interface!
SOLVED

Changing to token to camelcase

Avatar

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

Avatar

Correct answer by
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



David Kangni

View solution in original post

4 Replies

Avatar

Correct answer by
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



David Kangni

Avatar

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()"

Avatar

Level 3
Sorry this did not work. Wish ACS was easier to use

Avatar

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.