- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2019 07:57 PM
Hi all,
I need to autopopulate the mobile number field from the sys_user table on the catalog item:
I am using javascript:gs.getUser().getRecord().getDisplayValue("mobile_phone"); in the default value tab of the variable "Contact Number" to get this autopopulated, but it does not, any suggestions?
I do not need change this field through onChange or any Catalog client scripts as I am leaving this field open anyway for them to change the contact number if they want to (because for example: changed phone number but not updated on sys_user record).
Thanks.
Solved! Go to Solution.
- Labels:
-
Personal Developer Instance

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2019 09:05 PM
there's a gs.getUser() method for it, so you could use the following directly in the default value of the field or variable:
javascript: var userPhone; var user = new GlideRecord('sys_user'); if (user.get(gs.getUserID())) {userPhone = user.phone}; userPhone;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2019 09:04 PM
what is the filed type on catalog item for contact number,and u are looking requested for details or logged in user details
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2019 10:59 PM
Field type is single line text for the contact number. And I am looking for logged in user details on the portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 03:12 AM
in default value
javascript: var userPhone;
var user = new GlideRecord('sys_user');
if (user.get(gs.getUserID()))
{userPhone = user.mobile_phone};
userPhone;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2019 11:23 PM
Hi
To populate the phone number of the logged in user in catalog
Personalise Variable -> Default value
javascript: var userPhone;
var user = new GlideRecord('sys_user');
if (user.get(gs.getUserID()))
{userPhone = user.phone};
userPhone;
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2019 11:25 PM
PLease follow the below link