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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Is there a way to get users createdDate with Scriptrunner for Confluence ?

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 02, 2023

Hi Community,

I know this from Jira where this can be done very easily with the following method:

user.getCreatedDate()

 

Does anyone know a comparable way to achieve this in Confluence?

 

I found the following but I couldn´t figure out how/where to implement:

https://docs.atlassian.com/ConfluenceServer/javadoc/8.6.1/com/atlassian/confluence/impl/user/crowd/CachedCrowdUser.html#getCreatedDate()

 

I get users via the userAccessor so I have no idea what to do with this CachedCrowdUser =S

 

Any help appreciated. Thanks in advance.

Best
Stefan

2 answers

1 accepted

3 votes
Answer accepted
Helmy Ibrahim _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.
Nov 02, 2023

Hi Stefan,

You can get the CachedCrowdUser object by using CrowdService.getUser method.

For example:

import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.crowd.embedded.api.CrowdService
import com.atlassian.crowd.model.user.TimestampedUser

def crowdService = ComponentLocator.getComponent(CrowdService)
def user = crowdService.getUser('admin') as TimestampedUser

user.getCreatedDate()

I hope this helps! 

Kind regards,
Helmy

Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 03, 2023

Hey @Helmy Ibrahim _Adaptavist_ 

that´s awesome. Thank you so much for your help.

 

Best
Stefan

0 votes
Matt
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.
Nov 02, 2023

I don't have a solution for the JAVA-side of things but maybe this REST solution can prove useful or at least point you in a helpful direction?

The /audit endpoint allows you to review activity related to your instance, including when users are synched from AD, say to the "confluence-users" group, or when created manually.
docs.atlassian.com/atlassian-confluence/REST/6.2.1/#audit-getAuditRecords

Basically, you'd call the audit endpoint, get a list of records (optionally you can specify a timeframe), parse each record to determine if the "summary" = "User created", then capture the "creationDate" property.

Maybe for JAVA, start here? 
com.atlassian.confluence.audit (Atlassian Confluence 8.6.1 API)

Matt
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.
Nov 02, 2023

Forget this nonsense! Use Helmy's solution!

Like Stefan Salzl likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events