- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2015 02:28 AM
Hi there
I have a workflow which creates a new record:
var snuser = new GlideRecord('sys_user');
snuser.initialize();
snuser.first_name = current.variables.first_name;
snuser.last_name = current.variables.last_name;
snuser.location = current.variables.location;
snuser.u_start_date = current.variables.start_date;
snuser.title = current.variables.job_title;
snuser.u_end_date = current.variables.end_date;
snuser.company = current.variables.company;
snuser.u_division = snuser.company.parent;
snuser.insert();
From here, I want to populate that new user record into the the requested_for field, but, I am unsure of how to retrieve the sys_id of the new user to be able to add it into the field?
Any help would be appreciated
Thank you in advance.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2015 02:33 AM
Here you go.
var snuser = new GlideRecord('sys_user');
snuser.initialize();
snuser.first_name = current.variables.first_name;
snuser.last_name = current.variables.last_name;
snuser.location = current.variables.location;
snuser.u_start_date = current.variables.start_date;
snuser.title = current.variables.job_title;
snuser.u_end_date = current.variables.end_date;
snuser.company = current.variables.company;
snuser.u_division = snuser.company.parent;
var sysId = snuser.insert(); // sysId will contain the record created sys_id

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2015 02:33 AM
Here you go.
var snuser = new GlideRecord('sys_user');
snuser.initialize();
snuser.first_name = current.variables.first_name;
snuser.last_name = current.variables.last_name;
snuser.location = current.variables.location;
snuser.u_start_date = current.variables.start_date;
snuser.title = current.variables.job_title;
snuser.u_end_date = current.variables.end_date;
snuser.company = current.variables.company;
snuser.u_division = snuser.company.parent;
var sysId = snuser.insert(); // sysId will contain the record created sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2015 02:45 AM
That simple! Thank you so much for your quick response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2015 02:33 AM
Hi Pennie
var snuser = new GlideRecord('sys_user');
snuser.initialize();
snuser.first_name = current.variables.first_name;
snuser.last_name = current.variables.last_name;
snuser.location = current.variables.location;
snuser.u_start_date = current.variables.start_date;
snuser.title = current.variables.job_title;
snuser.u_end_date = current.variables.end_date;
snuser.company = current.variables.company;
snuser.u_division = snuser.company.parent;
var newsys_id = snuser.insert();
newsys_id is your newly created id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-24-2015 02:45 AM
That simple! Thank you so much for your quick response