Token Default=edit me Not Replaced | Community
Skip to main content
Isabelle_Kaleka
New Participant
February 4, 2021
Solved

Token Default=edit me Not Replaced

  • February 4, 2021
  • 1 reply
  • 1892 views

Hi, I have this code to make it so the Lead's first name is changed from all caps, what we have in the database, to just first letter cap.  When there is no first name in the database, I would like to replace it to some default text, like Hi There, but it just ends up being blank. 

 

I insert the token, which looks like this, with the default inputted: {{my.First Name First Letter Cap:default=Hi There}}

And when I check the preview, View By Default shows the subject as: {{my.First Name First Letter Cap}}. View By Person is just blank (when I select someone with no first name) or by there first name if they do have one. 

This is the token code:

#set( $name = $lead.FirstName ) #if( !$name.isEmpty() ) ${name.substring(0,1).toUpperCase()}${name.substring(1).toLowerCase()} #end

 

Is there something I need to add so that the Default text is picked up?

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 Michael_Florin-2

That default version is not for script tokens. Just put the variant for empty first names in your script:

#set( $name = $lead.FirstName ) #if( !$name.isEmpty() ) ${name.substring(0,1).toUpperCase()}${name.substring(1).toLowerCase()} #else There #end

 

1 reply

Michael_Florin-2
Michael_Florin-2Accepted solution
New Participant
February 4, 2021

That default version is not for script tokens. Just put the variant for empty first names in your script:

#set( $name = $lead.FirstName ) #if( !$name.isEmpty() ) ${name.substring(0,1).toUpperCase()}${name.substring(1).toLowerCase()} #else There #end

 

Isabelle_Kaleka
New Participant
February 4, 2021

Ah! Okay, thanks for the info.