Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How to set user's properties using Jira java API ?

Valerie AQUILA May 30, 2013

In a REST plugin module, I need to get and set user's properties.

Get works well, with

ComponentAccessor.getUserPropertyManager();

that gives the propertySet.

But how to "set" a new property, and change and existing one, using java api ?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Jobin Kuruvilla [Adaptavist]
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.
May 30, 2013
PropertySet ps = propertiesManager.getPropertySet()();
ps.setString("property.key","value");

String value = ps.getString("property.key");

You can also use Boolean, Date etc in addition to String values.

Valerie AQUILA May 30, 2013

Hi Jobin

Never thought before it could be so easy ...

Thanks a lot, it works perfectly !

Also, I should by your new version of "Jira Dev Cookbook" ...

Jobin Kuruvilla [Adaptavist]
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.
May 30, 2013

Hope you finds it useful :)

Prakhar Srivastav February 10, 2016

Hi Jobin

In my case adding a property like this does not make it visible in JIRA . Although adding it to like

ps.setString("jira.meta.key","value"); 

make the property visible in JIRA.

1 vote
Tony March 19, 2015

To make the property visible in JIRA, use:

ps.setString("jira.meta.key","value");

TAGS
AUG Leaders

Atlassian Community Events