Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Create a customer code using the First letter of a customer name and the last 4 digits of a phone number


Level 2

I am trying to create a form where one the customer has input their name and phone number it should grab the first letter of the customer's name and then the last 4 digits of the phone number.

I am not very good at coding, and have VERY VERY limited background in coding. I understand a little (the basics pretty much).

I am thinking i am not using the right expression to get what i want. Below is the statement I have write. This is just to find the first letter of the name, have an idea on how to get the phone number but i was trying the use the "left" and "right" functions but they wouldn't work. More specifically the left.

form1.#subform[0].CustCode::initialize - (JavaScript, client)

str = CustName;

var a = str.substr(0, 1);

any help would be greatly appreciated.

If more information is needed, please don't hesitate to ask.

2 Replies


Level 7

If you switch your language to FormCalc you can use the Left and Right functions, e.g.

Concat(Left(Name,1) , Right(Phone,4))