Equivalent of titleCase in expression | Adobe Higher Education
Skip to main content
Level 2
July 1, 2025
Resuelto

Equivalent of titleCase in expression

  • July 1, 2025
  • 3 respuestas
  • 1125 visualizaciones

Hi there, may i ask what is the equivalent of titleCase (that is found in email) I can use in expression in Custom Action Field? A typical use case/my objective is to transform JOHN SMITH EXAMPLE to John Smith Example - basically start each word with a block letter.

 

Thanks!

Mejor respuesta de Mohan_Dugganab

Hi @mohan_dugganab, just to clarify, JOHN SMITH EXAMPLE is all in the firstname field. And it can be more than 3 words.

Thanks 🙂

 


It's strange to see that there are multiple words in first name. 

Below is a simple example and you can expand on it using additional functions like listSize (if needed)

if ( indexOf("MOHAN DUGGANABOIENA"," ")>=0 ) then ( (upper(substr(getListItem(split("MOHAN DUGGANABOIENA"," "),0), 0, 1))) + (lower( substr(getListItem(split("MOHAN DUGGANABOIENA"," "),0), 1))) + ' '+ (upper(substr(getListItem(split("MOHAN DUGGANABOIENA"," "),1), 0, 1))) + (lower( substr(getListItem(split("MOHAN DUGGANABOIENA"," "),1), 1))) ) else ( (upper(substr('MOHAN', 0, 1))) + (lower( substr('MOHAN', 1))) )

 

3 respuestas

Anuhya-Y
Community Advisor
Community Advisor
July 1, 2025
AK5Autor
Level 2
July 2, 2025

Hi @2754447, that's just lower case. I need to basically start each word with a block letter. Reminder, what's the expression equivalent to the titleCase that we use in Email HTML?

 

Thanks.

Anuhya-Y
Community Advisor
Community Advisor
July 2, 2025

@ak5 try camelCase function.

DavidKangni
Community Advisor
Community Advisor
July 2, 2025

Hi @ak5 ,

 

Try this concat(upper(substr('DAVID', 0, 1)),lower(substr('DAVID',1)))
Replace DAVID by firstname or lastname.

 

Thanks,

David

David Kangni
AK5Autor
Level 2
July 4, 2025

Thanks @davidkangni, it only formatted the first letter of the firstname: John smith example. The expected outcome is John Smith Example.

DavidKangni
Community Advisor
Community Advisor
July 7, 2025

@ak5 

you can replicate the same logic for lastname

concat(upper(substr('JOHN', 0, 1)),lower(substr('JOHN',1))) +' '+concat(upper(substr('SMITH', 0, 1)),lower(substr('SMITH',1))) 

David Kangni
Mohan_Dugganab
Adobe Employee
Adobe Employee
July 2, 2025
(upper(substr(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName}, 0, 1))) + (lower( substr(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName}, 1)))

You can validate using an expression on the above lines

AK5Autor
Level 2
July 4, 2025

Thanks @mohan_dugganab, the result is the same as the above solution: it only formatted the first letter of the firstname: John smith example. The expected outcome is John Smith Example. Thanks.

Mohan_Dugganab
Adobe Employee
Adobe Employee
July 4, 2025

Kindly try this 

(upper(substr(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName}, 0, 1))) + (lower( substr(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.firstName}, 1))) + ' '+ (upper(substr(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.lastName}, 0, 1))) + (lower( substr(#{ExperiencePlatform.ProfileFieldGroup.profile.person.name.lastName}, 1)))