Convert small letter to capital letter

User_267
Tera Contributor

There are two fields last name and name. So when I enter something in last name field. The first letter it needs to be populate in name field.  

I used below code:

Using onchange

Var name1= g_form.getValue('lastname');

Var f1= name1.charAt(0);

g_form.setValue("name", f1);

 

So this code is working fine for autopopulate.

For ex: lastname- Testing

Name-t (small letter)the first letter is in small letter I need capital letter how to add that in this code.

 

2 REPLIES 2

Danish Bhairag2
Tera Sage
Tera Sage

Hi @User_267 ,

 

U can make use of this at below line of code

g_form.setValue("name", f1.toUpperCase());

 

Thanks,

Danish

 

 

Ankur Bawiskar
Tera Patron
Tera Patron

@User_267 

you can use toUpperCase() as shared by Danish

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader