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

Can I report based on user properties?

Rita YOUNES [Infosysta]
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.
February 5, 2016

Can I have a report where i can see information of all users which contain user properties?

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Answer accepted
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 18, 2016

At a high level you can report of all users details stored in the JIRA User managment screen along with some extra properties for the user using a script similar to below which was adapted from the article here.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.util.UserUtil
 
UserUtil userUtil = ComponentAccessor.getUserUtil()
 
def result = ""
 
// Get details for each user
userUtil.getUsers().findAll{it.isActive()}.each{ u ->
    result += u.name + "," + u.displayName + "," + u.emailAddress + "," + u.properties + "<br/>"
}
 
// Use these three lines for all users rather than all active users
//userUtil.getUsers().findAll().each{ u ->
//    result += u.name + "," + u.displayName + "," + u.emailAddress  + "," + u.properties + "<br/>"
//}
 
// Return the results out to the script console in a comma seperated format which can be taken and pasted into another tool such as excel
def header ="Username" +"," + "Full Name" +"," + "Email" +"," + "User Properties Array"
def formatteresult = header +"<br/>" + result
 
return formatteresult

If you need further details for users please let me know.

I hope this helps.

Thanks

Kristian

Rita YOUNES [Infosysta]
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.
February 18, 2016

Hi @Kristian Walker (Adaptavist)

Where I should use this code?

I want to get the user property in a gadgets is it feasible?

Awaiting your help.

 

Thanks

Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 18, 2016

Hi Rita,

This code would need to be placed ran in the script console which can be accessed under Add Ons > Script Console as shown below.

image2016-2-18 14:1:20.png

This cannot be placed in a dashboard gadget as Script Runner does not currently provide any dashboard gadgets. I you could raise a new feature request for this at https://productsupport.adaptavist.com/servicedesk/customer/portal/2 then we may be able to look to implement this feature in future releases.

Their may be some plugins on the Atlassian marketplace which may help but I do not of any to recommend of the top of my head.

Thanks

Kristian

chaitanya prabhu July 26, 2016
Hi @Kristian Walker (Adaptavist)
I tried the above sample script to fetch the user properties from JIRA user management and it printed on the Script runner's console. But alas, it did not print the properties set on the user. Is there a separate property in User to be used for the same? Please advise. 
We have a requirement to store 'Company' and 'Location' as property with key as afore mentioned items and appropriate values for the same. And at the end of a timeline, we would want to fetch the properties of all the active users to be used in a report. Any suggestion would be appreciated. Thanks! 
Kind Regards,
Chaitanya Prabhu

 

chaitanya prabhu July 26, 2016

@Kristian Walker (Adaptavist), this is the data that I get on accessing the properties field of user, unlike what I thought it would be --> 

[active:true, class:class com.atlassian.jira.user.DelegatingApplicationUser, id:10200, key:jiraapiuser, directoryId:10000, directoryUser:JiraAPIUser:10000, emailAddress:jiraapiuat@xxxx.xxx, username:JiraAPIUser, name:JiraAPIUser, displayName:JiraAPIUser]

The properties added to the user, like key and value is no where to be seen.

Hope this clears my query. Thanks!

0 votes
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 18, 2016

Hi Rita,

Could I please clarify what you mean by user properties and what information you would like to report?

Thanks

Kristian

0 votes
Rita YOUNES [Infosysta]
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.
February 18, 2016

@Kristian Walker (Adaptavist) do you have any idea concerning this issue?

TAGS
AUG Leaders

Atlassian Community Events