- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-14-2018 12:09 PM
Hi everyone,
I created a table, name is users_phone. This table have a phone_number field and this field filled by it users. I want to create a Request, from the Service Portal and request form have variable name is Own_Phone_Number. So I want to get phone_number field value from users_phone table and set this value request form variable Own_Phone_Number field when users creating Request. I tried catalog client script or business rule, but i didn't get any solution. Please help for this issue.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 12:42 PM
Hello Huseyin,
The following Catalog Client Script should work for you. Create a OnChange script with Field set as the Name of the Field which refers to the user_phone table.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var gr = new GlideRecord('users_phone');
gr.addQuery('NameOfFieldInUsers_phoneTable', newValue);
gr.query();
if(gr.next()){
g_form.setValue('Own_Phone_Number',gr.mobile_phone);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 11:56 AM
Not reference field. Users have external data or voice sim cards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 12:42 PM
Hello Huseyin,
The following Catalog Client Script should work for you. Create a OnChange script with Field set as the Name of the Field which refers to the user_phone table.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var gr = new GlideRecord('users_phone');
gr.addQuery('NameOfFieldInUsers_phoneTable', newValue);
gr.query();
if(gr.next()){
g_form.setValue('Own_Phone_Number',gr.mobile_phone);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2018 05:57 AM
Thank you Eash,
This script useful and i change some variable fields , working good.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 01:04 PM
Thank you Eash, this script simply get table field value and set to another field. But this field needs to be filled according to the name of the requested_for.
This is the complicated part. I could not figure out how to write this code. If requested_for X ,get the table value X's phone number. If I change the requested_for Y, get the table value Y' s phone number. It must be a dynamic variable field.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2018 01:10 PM
The above solution by Eash will work. The onhange field should be the request for field
Please mark this response as correct or helpful if it assisted you with your question.