- 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 12:40 AM
Hello Devika,
Refer to these links. This should help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-24-2020 01:02 AM
Hi Asif,
We have enabled the notifications. The requirement is to enable these notifications for all the users at once using scripting.
Regards,
Devika.

- 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 02:19 AM
Hi Asif,
Is it okay to insert new records into this table manually? Does it affect any other things or data?
Please let me know whether any another dependencies are there on this table?
Regards,
Devika.