JIRA- I need to let all users get notified for thier changes, but for all users

wajdhaikal
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.
March 24, 2012

Hi, I need to let all users get notified for thier changes, I need toi set this value to true in database for all users, by default this value is set to false. user>profile>preferences

1 answer

1 accepted

1 vote
Answer accepted
Dieter
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.
March 24, 2012

This can be achieved using a groovy script that is run in the Groovy Script Runner Plugin panel

import com.atlassian.crowd.embedded.api.User
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.user.preferences.PreferenceKeys;
import com.atlassian.jira.user.preferences.UserPreferencesManager
import com.atlassian.jira.user.util.UserUtil
import com.atlassian.jira.util.JiraEntityUtils
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueRelationConstants


// this script sets flag "notify about own changes" to true for a set of users
// change this if you don't want it for all users (jira-users)
String do_it_for="jira-users"

UserPreferencesManager upm = ComponentManager.getInstance().getUserPreferencesManager()
UserUtil userUtil = ComponentManager.getInstance().getUserUtil()
SortedSet<User> members = userUtil.getAllUsersInGroupNames([do_it_for])

String result = "Users that will be notified about own changes now:\n"
try {
	members.each() {
		User user = it
		prefs = upm.getPreferences(user)
		prefs.setBoolean(PreferenceKeys.USER_NOTIFY_OWN_CHANGES, Boolean.TRUE);
		result += "- "+user.getName()+" ("+user.getDisplayName()+")\n"
	}
	return result
} catch (e) {
}
// make sure change is visible immediately
upm.clearCache()

return result

If you want to change the preference for other users, just change the group name in variable do_it_for

wajdhaikal
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.
March 24, 2012

Great many thanks!!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events