Populate mobile number of the caller

Sam198
Mega Guru

Hi all,

I need to autopopulate the mobile number field from the sys_user table on the catalog item:

find_real_file.png

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.

 

 

1 ACCEPTED SOLUTION

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;

View solution in original post

14 REPLIES 14

Nirosha Uddandi
Kilo Guru

what is the filed type on catalog item for contact number,and u are looking requested for details or logged in user details

Field type is single line text for the contact number. And I am looking for logged in user details on the portal.

in default value

javascript: var userPhone;

 

var user = new GlideRecord('sys_user');

 

if (user.get(gs.getUserID()))

 

{userPhone = user.mobile_phone};

 

userPhone;

Service_RNow
Mega Sage

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