- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 07:00 PM
Hi All,
I have added one particular role to all users in ServiceNow using Scripts - Background.
I've included the code for reference. Script execution is done and I am getting results like this. Please take a look at the screenshot for reference. I am not sure why am I getting the below results"FAILED TRYING TO EXECUTE ON CONNECTION" Will it cause any issue in the PROD after implementing it ?
(function(){
var grUser = new GlideRecord("sys_user");
grUser.addActiveQuery(); // Get only active users
grUser.query();
while(grUser.next()){
var grMember = new GlideRecord('sys_user_grmember');
grMember.initialize();
grMember.group = "bc1c81351bdb3d100da14223cd4bcb3c";
grMember.user = grUser.sys_id;
grMember.insert();
}
})();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 07:15 PM
your code looks okay. However, you should also know that whatever error messages appeared in parallel during execution of the code will not only be printed in the syslog table but also in the output window. As your PROD is different, you might not have the same database issues there. And in case you have issues there, they do not necessarily have to do with the execution of your script.
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 07:15 PM
your code looks okay. However, you should also know that whatever error messages appeared in parallel during execution of the code will not only be printed in the syslog table but also in the output window. As your PROD is different, you might not have the same database issues there. And in case you have issues there, they do not necessarily have to do with the execution of your script.
Maik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2024 01:57 AM
Thank you for the clarification. The error messages are displayed only in the DEV instance. On testing in the TEST instance, it worked perfectly without error. Thank you
Regards,
Naganandini N