Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

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

Avatar

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

Avatar

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