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

Need help with Jython script for commenting on issue

I have button "Review" in Jira workflow with no screens. Whenever a manager reviews the issue he has to click on the Review button. Once this button is clicked jython script should automatically create comment like "Review performed by <user who clicked review> at <current time>.

I have written a jython script in post function however it does not work and give me errors. Below are the script and errors. Let me know where it went wrong and provide the correct syntax pls.


from com.atlassian.jira import ComponentAccessor

from com.atlassian.jira import ComponentManager

from com.atlassian.jira.util import ImportUtils

from com.atlassian.jira.issue.comments import CommentManager

from com.atlassian.jira.datetime import datetime

subTaskManager = ComponentManager.getInstance().getSubTaskManager()

commentManager = ComponentManager.getInstance().getCommentManager()

authenticationContext = ComponentManager.getInstance().getJiraAuthenticationContext()

currenttime =

comment = "Peer review performed by \"" + authenticationContext.getLoggedInUser().toString() + "\" at \"" + currenttime

commentManager.create(comment, True)



root cause: Traceback (most recent call last): File "<string>", line 5, in <module> ImportError: cannot import name datetime

1 answer

Try this one. Dont use componentmanager most of functions were deprecated.

from com.atlassian.jira.component import ComponentAccessor
from com.atlassian.jira.issue import Issue
from java.util import Calendar

Calendar = Calendar.getInstance();

comment = "Peer review performed by \"" + LoggedUser.toString() + "\" at \"" + Time
CommentManager.create(issue, LoggedUser, comment, True)


Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Next-gen

Keyboard shortcuts have arrived for next-gen projects!

...ollected feedback from users around the lack of shortcuts, and we’re here to address that: In next-gen projects, I miss the keyboard shortcuts badly. This is particularly true on the Board, but also i...

222 views 2 4
Read article

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