We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Unable to see Fix Script output while running this script .

shubhamsriv
Tera Contributor
new GlideQuery('sys_user').where("active", true).where('user_name', 'minnie.mouse').select('user_name', 'sys_id', 'mobile_phone').foreach(function(u) {
    gs.info( '\n' +'user name' + u.user_name + '\n'+ 'sys_id is' + u.sys_id + 'mobile number' + u_mobile_phone);
});
2 ACCEPTED SOLUTIONS

Brad Bowman
Mega Patron

The following works for me.  Corrected forEach and u.mobile_phone

new GlideQuery('sys_user')
    .where("active", true)
	.where('user_name', 'abel.tuter')
	.select('user_name', 'sys_id', 'mobile_phone')
	.forEach(function(u) {
		gs.print('\n' + 'user name' + u.user_name + '\n' + 'sys_id is' + u.sys_id + 'mobile number' + u.mobile_phone);
    });

 https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/Glid... 

View solution in original post

Eshwar Reddy
Kilo Sage

Hi @shubhamsriv 

Use the below script

new GlideQuery('sys_user')
.where("active", true)
.where('user_name', 'abel.tuter')
.select('user_name', 'sys_id', 'mobile_phone')
.forEach(function(u) {
gs.info('\n' + 'user name: ' + u.user_name + '\n' + 'sys_id is: ' + u.sys_id + '\n' + 'mobile number: ' + u.mobile_phone);
});
 

Please mark this response as Correct and Helpful if it helps you can mark more that one reply as accepted solution

 

Thanks 
Eshwar

View solution in original post

2 REPLIES 2

Brad Bowman
Mega Patron

The following works for me.  Corrected forEach and u.mobile_phone

new GlideQuery('sys_user')
    .where("active", true)
	.where('user_name', 'abel.tuter')
	.select('user_name', 'sys_id', 'mobile_phone')
	.forEach(function(u) {
		gs.print('\n' + 'user name' + u.user_name + '\n' + 'sys_id is' + u.sys_id + 'mobile number' + u.mobile_phone);
    });

 https://docs.servicenow.com/bundle/xanadu-api-reference/page/app-store/dev_portal/API_reference/Glid... 

Eshwar Reddy
Kilo Sage

Hi @shubhamsriv 

Use the below script

new GlideQuery('sys_user')
.where("active", true)
.where('user_name', 'abel.tuter')
.select('user_name', 'sys_id', 'mobile_phone')
.forEach(function(u) {
gs.info('\n' + 'user name: ' + u.user_name + '\n' + 'sys_id is: ' + u.sys_id + '\n' + 'mobile number: ' + u.mobile_phone);
});
 

Please mark this response as Correct and Helpful if it helps you can mark more that one reply as accepted solution

 

Thanks 
Eshwar