Proper function in ACS | Community
Skip to main content
Level 2
April 3, 2021
Solved

Proper function in ACS

  • April 3, 2021
  • 2 replies
  • 1337 views

I need to use a proper function to change the case of any field to proper (first letter capital rest small, but acs is not taking this function what can be done?

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 Xyborg

You could use Smart() inside a workflow:
https://experienceleague.adobe.com/docs/campaign-standard/using/managing-processes-and-data/filtering-data/list-of-functions.html?lang=en#string

SmartReturns the string with the first letter of each word in capitalsSmart(<string>)

 

In my case, I created the following content block so I would be able to do the same on single shot deliveries:

<%=context.profile.firstName.toLowerCase().replace(/(^\w{1})|(\s+\w{1})/g, function(e){return e.toUpperCase();})%>

 

The code shared before, will do what you need with every word in the field, in this case I am targeting the "firstName". This is useful when you have names like "john lucas" -> "John Lucas", as the other functions I found out there only changed the first character ("John lucas").

2 replies

Adobe Employee
April 5, 2021

At which place do you need the function?

Inside a workflow, import, E-Mail, ...?

Xyborg
XyborgAccepted solution
April 7, 2021

You could use Smart() inside a workflow:
https://experienceleague.adobe.com/docs/campaign-standard/using/managing-processes-and-data/filtering-data/list-of-functions.html?lang=en#string

SmartReturns the string with the first letter of each word in capitalsSmart(<string>)

 

In my case, I created the following content block so I would be able to do the same on single shot deliveries:

<%=context.profile.firstName.toLowerCase().replace(/(^\w{1})|(\s+\w{1})/g, function(e){return e.toUpperCase();})%>

 

The code shared before, will do what you need with every word in the field, in this case I am targeting the "firstName". This is useful when you have names like "john lucas" -> "John Lucas", as the other functions I found out there only changed the first character ("John lucas").

Sukrity_Wadhwa
Community Manager
Community Manager
April 13, 2021
Hi @pushpad15690171, Was this solution helpful to resolve your query? Do let us know. Thanks!
Sukrity Wadhwa