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

How to append a text string to an issue's history? Edited

Can anyone point me to materials or examples of how to append a text string to the history of an issue using ScriptRunner/Groovy.  I believe that this would be as a Behaviour, not a Listener or Post action.

I've spent days in Google Search looking for examples and all I've come away with is don't use the ComponentManager in favor of the ComponentAccessor.

Jira v8.0.2 / ScriptRunner v5.5.7.1

Thank you.

1 answer

1 accepted

0 votes
Answer accepted
Payne Community Leader Sep 10, 2019

When do you wish for this to happen, and what exactly do you mean by the history - perhaps a comment?

On an Issue page, down under Activity, there are the following "tabs": All, Comments, Work Log, History, Activity, CI Builds.

The History tab seems to be keeping track of activities that are lower level than humans posting comments on an issue.

That's the History I was referring to.

What we'd like is that when we perform an action in ScriptRunner (for example, moving an issue from one status to another automatically) that our script would add something to the History documenting the source of that change.

Did that answer your question?

Payne Community Leader Sep 10, 2019

We do something similar - using a post function we selectively transition an issue programmatically, and when we do, that shows in the issue history. Are you not getting this, or perhaps this isn't quite what you're doing?

jira.png

I didn't want to assume that it was there.

Now I will.  I'll assume that post functions that change something in an issue adds something to the History.

Thank you, Payne.

However...

What if it's happening in a ScriptRunner Groovy script as a Behaviour?  If the script changes something in an issue, will that always appear in the History?

If not, any suggestions on how to write something to the history?

Payne Community Leader Sep 10, 2019

Yes; EVERY change (except comments and changes to comments) SHOULD be recorded in the History tab.

Perfect!

Thank you, Payne.

Payne Community Leader Sep 10, 2019

The way we use Behaviours (and there may well be more functionality that I'm unaware of) is to do things in the UI as it renders. That by itself is nothing to record in history. However, if the user goes through with his action, then any data element changes will be recorded.

Ah, got it.  Thanks, Payne.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

The add-in you’ve been waiting for: Jira Cloud for Excel 🙌

Introducing Jira Cloud for Excel Here at the product integrations team at Atlassian, we are thrilled to announce the new Jira Cloud for Excel add-in! This add-in lets you export Jira data directly ...

986 views 12 25
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