Forums

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

Get the creation date of users with Scriptrunner

Frank Lohfeld June 6, 2023

Good Morning,

How can i determine the creation date of an user with Scriptrunner?
The Last Login date can i determine with

import com.atlassian.jira.component.ComponentAccessor
CrowdService crowdService = ComponentAccessor.crowdService
UserWithAttributes user = crowdService.getUserWithAttributes(it.getName())
String lastLoginMillis = user.getValue('login.lastLoginMillis')

Is there also exists a function like login.lastLoginMillis with the cration Time? I Cant find it in the documentations but perhaps I'm to Stupid!

Ps: it is not possible for me to use SQL on the user table

1 answer

1 accepted

1 vote
Answer accepted
Aron Gombas _Midori_
Community Champion
June 6, 2023

From the code, you can see that the "user" object is an instance of a class that implements this interface:

https://docs.atlassian.com/atlassian-crowd/3.2.0/com/atlassian/crowd/model/user/UserWithAttributes.html

And that interface extends this super interface:

https://docs.atlassian.com/atlassian-crowd/3.2.0/com/atlassian/crowd/embedded/api/User.html

Which is also extended by this sub interface:

https://docs.atlassian.com/atlassian-crowd/3.2.0/com/atlassian/crowd/model/user/TimestampedUser.html

Therefore, if you are lucky, then the creation date would be available via this expression:

def x = user.createdDate
Frank Lohfeld June 6, 2023

Thank you very much

Suggest an answer

Log in or Sign up to answer