
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2017 08:42 PM
I have a field which is referenced to "sys_user" table . If i select a value from user table then value of some other fields populate automatically . Below are the fields
Do i need to Business rule or client script to archive this ? How
Solved! Go to Solution.
- 46,531 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2017 10:02 PM
Hi Dinesh,
Please try with script below.
function onChange(control, oldValue, newValue, isLoading) {
var caller = g_form.getReference('caller_id', doAlert); // doAlert is our callback function
}
function doAlert(caller) { //reference is passed into callback as first arguments
g_form.setValue('email',caller.email);
g_form.setValue('phone',caller.mobile_phone);
g_form.setValue('phone',caller.location);
}
Please change the variable name that you have exactly on your catalog form.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2017 09:02 PM
Hi Dinesh,
You can achieve this using scripting. You can use dot walking also.
Dot Walking: Dot-Walking - ServiceNow Wiki
Thanks,
Prasad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2017 09:55 PM
Hi Dinesh,
I would recommend to use OnChange client script to auto populate these values on the basis of requested for field.
http://wiki.servicenow.com/index.php?title=Client_Scripts#onChange.28.29_Scripts
http://wiki.servicenow.com/index.php?title=GlideForm_(g_form)#setValue
Take example of OOB client script '(BP) Set Location to User' that sets location on the basis of caller:
https://your_instance.service-now.com/sys_script_client.do?sys_id=5e524025c0a80166004d1761e85e2058
Thanks
Shruti
If the reply was informational, please like, mark as helpful or mark as correct!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2017 10:02 PM
Hi Dinesh,
Please try with script below.
function onChange(control, oldValue, newValue, isLoading) {
var caller = g_form.getReference('caller_id', doAlert); // doAlert is our callback function
}
function doAlert(caller) { //reference is passed into callback as first arguments
g_form.setValue('email',caller.email);
g_form.setValue('phone',caller.mobile_phone);
g_form.setValue('phone',caller.location);
}
Please change the variable name that you have exactly on your catalog form.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2019 01:07 AM
Hi Harsh,
I need to know why variable caller got created?