How to retrieve custom User Properties in JIRA?

I have added a number of properties to various users (via User>Actions>Edit Properties) and aim to use these properties in a mail handler plugin.

These properties are shown in the User page as per below:

image.png

and could also be retrieved from the DB via

select *
  from propertyentry pe,
    propertystring ps,
    app_user au
  where pe.ID = ps.ID
    and au.ID = pe.ENTITY_ID
    and PROPERTY_KEY like 'jira.meta.%'

However I am unable to retrieve these properties using UserPropertyManager (as per below):

UserPropertyManager userPropertyManager = ComponentAccessor.getUserPropertyManager();
PropertySet ps = userPropertyManager.getPropertySet(appUser);

The following output shows that the manually added properties are not displayed:

Collection<Object> keys = ps.getKeys();
for (Object key : keys) {
    LOG.debug("Property key   -> " + (String) key + "; Value -> " + ps.getAsActualType((String) key));
}

Therefore, how can I retrieve the manually added user properties in my JIRA plugin (Note that this is JIRA 6.3).

1 answer

0 votes
Gaston Valente Community Champion Jul 05, 2017

Daniel,

Did you try with UserPreferencesManager?

Hope it helps

 

 

Gaston,

Is it possible to print all items and values of Extended Preferences?

Thanks

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,870 views 12 18
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