Want to extract first two letters from first name and first three letters from last name to create UserId
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 04:23 AM
Hi All,
Can some one help me to extract first two letters from first name and last three letters from last name to create User Id upon submission of form.
Help is always appreciated.
Thanks and Regards,
Avinash balli
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 04:35 AM
Here is an example:
var firstname = 'John';
var lastname = 'Wayne';
var user = firstname.substring(0,2) + lastname.substring(0, 3);
gs.print(user);
With results:
[0:00:00.004] Script completed in scope global: script
*** Script: JoWay

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 04:36 AM
Hi Sergiu,
A slight modification, it should be first three letters from last name:
- var firstname = 'John';
- var lastname = 'Wayne';
- var user = firstname.substring(0,2) + lastname.substring(0,3);
- gs.print(user);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 04:43 AM
Hi Sergiu,
From last name I need last 3 letters.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2017 04:44 AM
Use this then:
var user = firstname.substring(0,2) + lastname.substring(lastname.length - 3, lastname.length);