Copying comment value to customfield description (Scriptrunner or HTML)

Hi All, 

 

Im having abit of trouble copy comment values of an issue into a description field, the purpose is that i would like for the value to appear as read only. 

 

The read only customfield appear to only hold 250 also max character which i have alot more of so im stuck with the 2 option of: 

1) Find a way to extend the 250+ character max value for the read only customfield; or

2) copy the value to the field description (Which i prefer)

 

the current code i have is which currently pulls the last comment value from a sepcific user: 

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.MutableIssue 
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.UpdateIssueRequest

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
MutableIssue issue = ComponentAccessor.getIssueManager().getIssueObject('TEST-429')
def userKey = "customer.care"
def commentManager = com.atlassian.jira.component.ComponentAccessor.getCommentManager()
def comments = commentManager.getComments(issue)
def lastCommentFromUser = comments?.findAll {it.authorApplicationUser.key == userKey}
def emailThread = lastCommentFromUser.last().body


def setVal = issue.setCustomFieldValue(customFieldManager.getCustomFieldObject(10806), emailThread)
		ComponentAccessor.getIssueManager().updateIssue(
            ComponentAccessor.getJiraAuthenticationContext().getUser()
            , issue
            , UpdateIssueRequest.builder().eventDispatchOption(EventDispatchOption.ISSUE_UPDATED).sendMail(false).build()
    )

return emailThread

Any help is much appreciated. 

 

Cheers, 

Pon

1 answer

0 votes
Vasiliy Zverev Community Champion Feb 26, 2017

There is a  custom field type "Unlimited text". Try to use this one.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 27, 2018 in Portfolio for Jira

Introducing a new planning experience in Portfolio for Jira (Server/DC)

In the past, Portfolio for Jira required a high degree of detail–foresight that was unrealistic for many businesses to   have–in   order to produce a reliable long-term roadmap. We're tur...

2,552 views 15 21
Read article

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