How to change email notification type for particulat user in Jira

OleN January 13, 2013

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.

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 13, 2013

Hi,

don't change things directly on the database, it's not recommended...

  1. Get Script Runner plugin
  2. Open Script Runner Panel and select "Groovy" as script engine
  3. Run the following script to change the setting for user "username"
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

OleN January 15, 2013

Hi Henning,

Thanks a lot for your response. It's exactly what I found.

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 15, 2013

Great :-) Maybe you could mark my answer as correct than.

Thanks!

Mike Lench
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 27, 2013

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'}

?

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 27, 2013

Hi Mike,

yes, that looks good for me.

Henning

bernard pelletier January 7, 2014

Thanks Henning, you saved my day.

Global Tools September 13, 2015

unable to resolve class com.atlassian.jira.user.preferences.PreferenceKeys getting for groovyrunner 3.0 is there any fix ?

Henning Tietgens
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 13, 2015

Try to save the script as a file on the server and execute the script file from the script runner console.

0 votes
OleN January 13, 2013

Hi Renjith,

I've asked about one user to be able to change notification type for several users.

0 votes
Renjith Pillai
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 13, 2013

Not an answer to your question, if it is just for one user, can't he just login and change the user profile himself?

TAGS
AUG Leaders

Atlassian Community Events