- 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:18 AM
on your request(catalog item) create a reference variable pointing to your new table. then you could create a script to find the record in that table and populate it in your request form.
a couple of questions that would help us is:
*some of these I am guessing:
- table name = "users_phone"?
- what field do you have to reference users?
- name: "u_user"?
- phone number field?
- name: "own_phone_number"?
- this should probably be display = true on your custom table
also, why not use the oob phone number field on the user table? or the notification device table if they have multiple?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2018 11:45 AM
Hi Nathan,
Table name= users_phone
table field name(keep phone numbers)= phone_number
table user field reference value= sys_user
catalog item variable name= Own_Phone_Number
catalog item requested_for reference field same table users field= sys_user
So I tried to reference field for catalog variable and than this field shows records number not phone_number field values.
This issue is about the sim cards. Sim cards and sim card numbers changes from between the users.
I didn't get the solution.Because if set requested_for user for example Nathan , it will search and get in the table same name Nathan's phone number.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2018 11:53 AM
catalog item variable name= "Own_Phone_Number" is this a reference field to your custom table "users_phone"?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2018 11:55 AM
If you have this request created, You should be storing the requester's reference in a variable.
Use getReference method to get the users phone number. Write an onChange script on Requester's reference field
You may find below blog helpful
getReferenceAdvanced, g_form.getReference and GlideAjax Alternatives
Please mark this response as correct or helpful if it assisted you with your question.