Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

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..

_____
This reply is 100 % GlideFather and 0 % AI

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
Tera 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.