Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

getRecord() not working in scoped application

Aavi
Mega Guru

Hi, am trying to get user details in scoped application and using the following syntax:

var empid= gs.getUser().getRecord().getValue('employee_number');
 
It's perfectly working in global but not in scoped. 
 
Any help will highly appreciated
 
1 ACCEPTED SOLUTION

aditya174
Tera Guru

Hi @Aavi,

 

Please try this code :

var user_id = gs.getUser().getID();
var gr = new GlideRecord('sys_user');
gr.get(user_id);
var userSource = gr.getValue('employee_number');
var empid= userSource;

 

Please mark my answer as helpful if it serves your requirement.

 

Regards,

Aditya

View solution in original post

5 REPLIES 5

Pavankumar_1
Mega Patron

Hi @Aavi ,

I  same script it will be available on the knowledge article. Which I have provided below.

If it helps please click Accept as Solution/hit the Thumb Icon.
ServiceNow Community MVP 2024.
Thanks,
Pavankumar