- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 12:29 AM
Please let me know how to enable push notifications for all the users at once using scripting.
Regards,
Devika.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 01:26 AM
Hello Devika,
They are managed in cmn_notif_device table. Try this code. This will register push notification to all active users of sys_user table.
var gr = new GlideRecord("cmn_notif_device");
var user = new GlideRecord("sys_user");
user.addActiveQuery();
user.query();
while(user.next()) {
gr.initialize();
gr.name="ServiceNow Classic Mobile Application"; //mention your application name
gr.type="Push";
gr.user=user.getValue("sys_id");
gr.active=true;
gr.insert();
}
Mark the comment as a correct answer and also helpful if it solves your problem.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 04:51 AM
This is the table used by user to store the user preference by device.
If you look at type column you can see different options such as email/push/sms etc
So whichever type of notification the user subscribes, then entry is made into this table.
For testing purpose, create a manual entry of 1-2 users and check once. Once working, then you can run a script.
Mark the comment as helpful and correct answer if it answers your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 08:52 PM
Thanks Asif

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2020 11:41 PM
Hello Devika,
Could you also mark the comment as a correct answer so that the question is moved to the solved list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-31-2023 10:41 PM
Hi Asif ,so where i need to use this script