Copy text in a comment box to another field

How can we copy the text in the comments box to another field. We don't see the comments box as an option when copying data from one field to another field.

1 answer

0 votes

You'll need some code to do this

To get started on that, at what point in the lifecycle of an issue do you want to do this? 

(including the decision on which comment, as they're not a field, they're a collection of, well, comments). 

 

 

This is the comment box that shows on every screen. After an individual enters comments and selects to move the task to the next status we want to capture the text and put it into another custom text field

 

Yes, that box is a series of comments, so you need to ask "which one". 

I think you've partially answered it - when you move an issue through a workflow transition, you can go through a screen, which has a comment box on it.  Is that what you want to duplicate?  Or do you just want "the last comment made before the transition" (might be useful if the transition does not have a screen)

Either way, you'll need a bit of code in a post-function to select and read the comment and duplicate the content into your field.  I'd do it with the script-runner of course.

We added scriptrunner and I put this as a post function but all it does is add this as the comment to the other field.

I'm copying text from the comment box to a field named "Division Manager Comments".

project = Dev-Change Management and issueFunctionin lastComment("inRole Division Manager")

I'm sorry, I'm a bit lost - you're trying to add the comment text to something, but I'm not sure what.  You say "the other field", but that's what you were asking for - to copy the comment into the other field.

The Division Manager enters text into the Comments field. I need to copy that comment into a custom field named "Division Manager Comments". When I put scriptrunner text in as a transition post function it just puts the "project = Dev-Change Management and issueFunctionin lastComment("inRole Division Manager")" string in the "Division Manager comments" field.

Ok, are you trying to use one of the pre-set scripts here, or are you writing a scripted post-function?

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 18, 2018 in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

21,774 views 2 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you