The CreatorCon Call for Content is officially open! Get started here.

how can I set notification/system notification true from code (not ui by clicking)?

AlexandraSz
Tera Contributor
 
8 REPLIES 8

GlideFather
Tera Patron

Hi @AlexandraSz,

can you please elaborate a bit more? This is too vague to understand your goal..

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


as I wroted below:
there's this screen:

AlexandraSz_0-1760094420123.png

and a I want toggle the System notification from code, not from UI because there are too many users who need to configure this

M Iftikhar
Giga Sage

Hi @AlexandraSz,

You can use this Glide function: setActive(GlideRecord notification, Boolean active)
It sets the user preference for a destination to receive or not receive notifications.
Link: PreferenceDestination - Scoped, Global | ServiceNow Developers

If my response helped, please mark it as the accepted solution so others can benefit as well.

 

Thanks & Regards,
Muhammad Iftikhar

If my response helped, please mark it as the accepted solution so others can benefit as well.

AlexandraSz
Tera Contributor

I want to sent emails some users, and some of them didn't get email, because their notification is on, but their system notification is off. I don't want to check hundreds of users manually one by one if they have it enabled or not. I want to set it for the users in bulk, preferably from code.