How to create User id ,on submission of first name and last name ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 12:06 AM
Hi ,
I want to create ,User id on combination of First name and last name .
When user submit if user id already exists in sys_user table ,it will create other than that .
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 10:13 AM
Mittu ,
How I can create unique user id ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 12:39 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 10:12 AM
Nikhil, There is issue if user id already exists then how it will create other user id .
Above will simple way there will be limitation correct then how I can create 5000 user id arleady exists .
How I can make unique id creation ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-12-2020 12:25 PM
Hi,
For that you can use the asynch business rule.
Below is the code which work properly as per your requirement.
( I have tested the code in background script)
var gr = new GlideRecord('sys_user');
gr.setLimit(100); // set limit for the number of records
gr.addQuery('active', 'true'); // add condition as per your requirement
gr.query();
while(gr.next())
{
gr.user_name=gr.getValue('first_name')+'.'+gr.getValue('last_name');
gr.setWorkflow(false);
gr.update();
}
Please mark my answer Helpful and Correct based on the impact.
Regards
Nikhil

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-13-2020 04:24 AM
Thanks all your effort .
Might be didnt explained in correctly .
5000 emails - like user id created into sys user with same user id
like rajy - First name - Rajive Last name Yumbo
rajy - Frist Name - Rajive Last Name Yumenda
........etc.
Now ,How I can create unique one .
becuase if user alreday exists then it will not create ,how i can create new one ?