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

This widget could not be displayed.
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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

144 views 2 0
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