Copying comment value to customfield description (Scriptrunner or HTML)

Deleted user February 23, 2017

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

1 vote
Vasiliy Zverev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 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
TAGS
AUG Leaders

Atlassian Community Events