How to get User preferences?


From my plug-in code, I want to access the User preferences for "Own Changes:" filed. Here is my code

Preferences userPrefs = ComponentManager.getInstance().getUserPreferencesManager().getPreferences(currentUser);

String userOwnChanges = userPrefs.getString(PreferenceKeys.USER_NOTIFY_OWN_CHANGES);

I am getting the following exception

com.opensymphony.module.propertyset.InvalidPropertyTypeException: Tried to retrieve PropertySet key 'user.notify.own.changes' as a String, but it is the wrong type.
at com.atlassian.jira.propertyset.PropertySetCache.getString(
at com.atlassian.jira.propertyset.JiraCachingPropertySet.getString(
at com.atlassian.jira.user.preferences.JiraUserPreferences.getString(
at com.teradata.engtools.jiraplugins.issueoperations.AddDetailedComment.isUserNotified(
at com.teradata.engtools.jiraplugins.issueoperations.AddDetailedComment.notifySpecificComment(
at com.teradata.engtools.jiraplugins.issueoperations.AddDetailedComment.addComment(
at com.teradata.engtools.jiraplugins.issueoperations.AddDetailedComment.doAdd(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at webwork.util.InjectionUtils$DefaultInjectionImpl.invoke(
at webwork.util.InjectionUtils.invoke(
at webwork.action.ActionSupport.invokeCommand(
at webwork.action.ActionSupport.execute(
at com.atlassian.jira.action.JiraActionSupport.execute(
at webwork.dispatcher.GenericDispatcher.executeAction(
at com.atlassian.jira.web.dispatcher.JiraWebworkActionDispatcher.service(
at javax.servlet.http.HttpServlet.service(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(
at com.atlassian.jira.web.filters.JiraLastFilter.doFilter(
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
at org.apache.catalina.core.ApplicationFilterChain.doFilter(

Is there any other way to achive this?

Thanks in advance!!


4 answers

Sorry, when I use getBoolean, it works.


iam searching for a solution to read and update user preferences of a gadget in mein Rest service? How can I access the portlet instance preferences? The following does only return the global JIRA preferences:




For getting user preferences from a gadget instance (portlet) programatically in java, you can find a good article here:

According to To get preference you must call gadget.getPref("your_pref_name"); in gadget.xml file. Than you can pass it parametr to your rest source (via params) to make backend logic and return correct response.

Suggest an answer

Log in or Join to answer
Community showcase
Maarten Cautreels
Posted Thursday in Off-topic

Friday Fun: What's your favourite beer/drink

As a Belgian, beer-lover and home brewer, beer is one of my great passions. I love the fact that with just a few ingredients (usually just water, hop and malt) you can create so many different tastes...

285 views 38 9
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot