Hi,
I need to change email notification type from html to text for particular user (user already exists) in Jira. I have full access to Jira database and as I undarstand it's possible to make only by changing appropriate data in database.
Does anyone know what fields in what tables are responsible for notification type configuration.
Thanks in advance.
Community moderators have prevented the ability to post new answers.
Hi,
don't change things directly on the database, it's not recommended...
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.user.preferences.PreferenceKeys def userManager = ComponentAccessor.getUserManager() def preferencesManager = ComponentAccessor.getUserPreferencesManager() userManager.getUsers().findAll{it.name=='username'}.each { user -> preferencesManager.getPreferences(user).setString(PreferenceKeys.USER_NOTIFICATIONS_MIMETYPE, 'text') }
You should adapt the ".findAll{it.name=='username'}" part to your needs or remove it, if you want to change the setting for all users. But I would suggest to discuss this with the users before doing it :-)
If you want to change it to HTML the last parameter for setString must be 'html'.
Henning
Great :-) Maybe you could mark my answer as correct than.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Henning,
can i get users which notification type differs from html?
can i use some code like this:
userManager.getUsers().findAll{preferencesManager.getPreferences(it).getString(PreferenceKeys.USER_NOTIFICATIONS_MIMETYPE)!='html'}
?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mike,
yes, that looks good for me.
Henning
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
unable to resolve class com.atlassian.jira.user.preferences.PreferenceKeys getting for groovyrunner 3.0 is there any fix ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to save the script as a file on the server and execute the script file from the script runner console.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not an answer to your question, if it is just for one user, can't he just login and change the user profile himself?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.