show the list of email address of all the user
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 08:44 AM
var grUser=new GlideRecord('sys_user');
grUser.query();
while(grUser.next())
{
gs.print(grUser.email);
}
i run it in background script of PDI but on running i got not authorized as output pls help me to corrected error
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-14-2024 11:32 PM
I would suggest you to check your scope first. It should be global. Other than that, you can refer this below code for your reference where I have pushed all the email of users in one array and also printing the count of total emails as shown in below snapshot
var emailArr = [];
var grUser = new GlideRecord('sys_user');
grUser.query();
gs.print(grUser.getRowCount());
while (grUser.next()) {
emailArr.push(grUser.getValue('email'));
}
gs.print(emailArr);
This will definitely helps you to resolved your issue. Let me know in case you need anything or you can DM on LinkedIn.
If this solution resolves your query, kindly mark it as the accepted solution and give it a thumbs up.
Best Regards,
Krushna Birla