Dynamic Creation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2016 08:20 PM
On a new call record i am adding new users dynamically when they call for the first time.
I also have the phone number on the form but I can't work out how to add the phone number entered on the form into the new user record that is created
My starting point is:
current.name = value;
current.insert();
How do I capture the phone number entered into the record?
Thanks
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2016 11:11 PM
var usr = new GlideRecord('sys_user');
usr.initialize();
usr.name = 'value you enter';
usr.email = 'email';
usr.phone_number = 'phone numer';
usr.insert();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2016 11:28 PM
Deep's reply will do the job. If not, could you post the full code so that we can understand better.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2016 12:47 AM
Word of caution.
We have something like this and the implementation was not built the right way.
I would advise having a field on the form that can uniquely identify the user (like email) and then use it to create the user record. If not, the system will be full of duplicate records as more users start to use the feature.
This could help you.
var getUser = new GlideRecord('sys_user');
if(!getUser.get('email',current.emailField))
{
getUser.initialize();
getUser.first_name=value;
getUser.email=current.emailField;
getUser.insert();
}