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

PostFunction currentUser

Francisco Trindade Aug 10, 2016

I have the following line of code

String currentUser = ((WorkflowContext) transientVars.get("context")).getCaller();

Then I proceed to call

(comment != "") && commentManager.create(parent, currentUser, comment, true);

My question is, that `CommentManager` now requires the `applicationUser` object instead of a `String`. So how do I get the `currentUser` that would return the `applicationUser`.

 

 

1 answer

1 accepted

1 vote
Answer accepted
Tarun Sapra Community Leader Aug 10, 2016

Once you get the currentUser then you can import UserManager and use

getUser(String userName) to get ApplicationUser and pass it to CommentManager

Tarun Sapra Community Leader Aug 10, 2016

For newer JIRA version you can try - 

getUserByName(userName) in UserManager instead of getUser(userName)

Francisco Trindade Aug 10, 2016

So something like,

ComponentAccessor.UserManager.getUserByName(currentUser) ?

Tarun Sapra Community Leader Aug 10, 2016

ComponentAccessor.getUserManager().getUserByName(currentUser)

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in Marketplace Apps & Integrations

Demo Den Ep. 4: Continuous Integration with CircleCI & Jira Software

Get ready! Demo Den Episode 4 is coming your way on Tuesday, May 28, 2018 with a Continuous Integration and Delivery special demo. CircleCI Director of Solutions Engineering, Eddie Webb will show us ...

531 views 0 4
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