Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

Automatically add a comment to jira issue via Script Runner

Automatically add a comment to jira issue

how can I do this via script runner? Jira server v8.5.0

1 answer

Hi @Helen Ahlberg you need to use postfunction. Snippet with the example code is here: https://library.adaptavist.com/entity/add-comment-to-an-issue-in-a-post-function

I want to have a pre-defined value comment on every transaction.

Not a comment after the action is done but during the transaction

ex

My issue is moved from A to B and when pressing go_to_B I want a predefined value shown

ex: Enter the check you have done:

so that users can enter a comment after, And I want all of this to end up under Comment (not a custom field)

Is this possible?

Hi @Helen Ahlberg are you familiar with Behaviours (https://scriptrunner.adaptavist.com/6.20.0/jira/behaviours-overview.html)?

You can use this code in Behaviours script

def predefinedComment = "some comment"
getFieldById("comment").setFormValue(predefinedComment)

OK - but this will give me a pre-defined comment when just creating the issue?

 

We have behaviuor scripts that populate text in the Description field but this only happens with create issue.

 

My user want to have different pre-define commenttext when tranfering the issue in its workflow  - is this possible?
Question -> 

getFieldById("comment")

is this the Jira 'field' comment?

Yes, behaviours works on transitions similary. You can use conditions in your source code (transition name, target status name...)

https://library.adaptavist.com/entity/limit-a-behaviour-to-a-specific-workflow-action

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS

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