It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

get the creation date of a user

Hi,

I try to develop a plugin and I need to know the creation date of each user. I don't think that it's possible using java classes so I try to use ActiveObject but I didn't know how to do that.

 

Can somebody help me?

 

Regards

1 answer

1 accepted

2 votes
Answer accepted

Hello,

You can do it like this:

import com.atlassian.jira.component.ComponentAccessor
def users = ComponentAccessor.getOfBizDelegator().findAll("User");
def usernames=new ArrayList<String>();
users.each{user ->

usernames.add(user.getString("createdDate"))
}
return usernames;

Thank you for your answer.

I have just one more question. What is the type of users ? I use java so I need the type.

 

Can you help me?

List<GenericValues>

This was exactly what I was looking for, but I would like to have the output be sorted by createdDate, how can I do this?

This is how I sort an array of objects, which contains username/date of creation/last login date, sorted by username :

Return = tempReturn.toSorted{a, b -> a.Username <=> b.Username}

where tempReturn contains all the objects, and Return is the final result. It's probably not the best way to do it, but it works for me, and I'm not concerned by performance obligations so I just need something that works, I'll clean/improve it later (I'm a bit rusty on the dev side, haven't done any in the past 5 years)

More infos there : https://mrhaki.blogspot.com/2015/03/groovy-goodness-new-methods-to-sort-and.html

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Jira Service Desk

How has Jira Service Desk increased productivity in your org?

Hi Jira Service Desk community, Atlassian is on a mission to unleash the potential of all teams, and we know that tools are just one piece of that puzzle. With Jira Service Desk, we have productiv...

184 views 0 3
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you