Copy text in a comment box to another field

Tom Scoggin January 28, 2016

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
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 28, 2016

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). 

 

 

Tom Scoggin January 28, 2016

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

 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 28, 2016

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.

Tom Scoggin February 22, 2016

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")

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 22, 2016

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.

Tom Scoggin February 22, 2016

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.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 22, 2016

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