Default value for Catalog Variable using reference field

MS25
Mega Sage

We have a custom table "u_extended_user_profile" which reference sys_user table using custom field "u_user". Two fields on our custom tables are: u_alternate_email_1 and u_alternate_email_1.

On a record producer, we would like to auto populate two variables with u_alternate_email_1 and u_alternate_email_1 using default value. 

javascript:gs.getUser().getRecord().getValue("u_alternate_email_1");   is not working. 

How do we dot walk and find u_alternate_email_1 for logged in user? 

 

1 ACCEPTED SOLUTION
4 REPLIES 4

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi MS - You can populate this via Client script + GlideAjax approach.

https://community.servicenow.com/community?id=community_blog&sys_id=f8ccee25dbd0dbc01dcaf3231f961978

SanjivMeher
Kilo Patron
Kilo Patron

As suggested by Pradeep, you can call a script include and use it

Or you can try below script

javascript:var u = new GlideRecord('sys_user');u.get(gs.getUserID());u.getValue("u_alternate_email_1"); 


Please mark this response as correct or helpful if it assisted you with your question.

Thanks, this worked for me, but can you explain why
gs.getUserID().getDepartmentID();  doesn't work?

Denny1122
Tera Contributor

Thanks, this worked for me, but can you explain why
gs.getUserID().getDepartmentID();  doesn't work?