First character uppercase source record

Hi,

how can I get my source record to first letter uppercase?

This works but it’s a new variable:
record.fields.voorvgsl.charAt(0).toUpperCase() + record.fields.voorvgsl.slice(1);

Here I want to change the source variable.
charAt(0).toUpperCase() + slice(1);

The first part is working, but obviously the slice part isn’t because I need to grab the data.
How can I do this?

Use this:

toLowerCase().replace(/(^.{1})(.*)/,function(m,p1,p2){return p1.toUpperCase()+p2;});

That expression converts all characters to lower case, then uses a regEx replace function to convert the first character to upper case. If you don’t want to convert everything to lower case first, just remove the toLowerCase(). part.

Hi Phil, late reply but thanks! this works.