Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I access to user`s properties from a velocity context?

Michael I.
Contributor
April 8, 2012

I want to modify e-mail templates so mail text will depend on user`s properties. The method com.opensymphony.user.User.getPropertySet() is unavailable in JIRA 5. Do you know some another way to access properties in this case?

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.
April 8, 2012
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.
April 8, 2012
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.
April 8, 2012
If you have problems getting the manager in the velocity context you may also use the User Property Custom Field provided by the Atlassian Jira Toolkit https://studio.plugins.atlassian.com/wiki/display/JTOOL/JIRA+Toolkit+Plugin
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.
April 8, 2012
Or if you like groovy scripting you might create your own fields based with user properties using a scripted custom field: https://studio.plugins.atlassian.com/wiki/display/GRV/Scripted+Fields To get the manager there you use the code ComponentAccessor.getUserPropertyManager()
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.
April 8, 2012
In the both field based solutions you can get the value of the property using $issue.getCustomFieldValue($customfield). The custom field object $customfield can be determined using #set ($customfield = $customFieldManager.getCustomFieldObjectByName("your property field name"))
Michael I.
Contributor
April 8, 2012

Dieter, your answers are very helpful, thank you!

jabybit July 18, 2016

@Michael I., were you able to solve this?

I'm using JIRA Automation Plugin (which I believe uses the Velocity Context) and I'm trying to retrieve a User Property like this: Issue > Reporter (aka User) > User Property key/value customid/1234, but not having luck.

I've tried variable substitution like

$UserPropertyManager.getPropertySet($issue.reporter).get("customerid")

but that didn't work.

My full question is here.

Thanks in advance. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events