I have a scripted field that only needs to return the toString value. Instead it returns the entire string value.
Here is the Script -
import com.atlassian.jira.ComponentManager
def componentManager = ComponentManager.getInstance()
def changeHistoryManager = componentManager.getChangeHistoryManager()
x = changeHistoryManager.getChangeItemsForField(issue, "Root Cause Primary")
if (x.join(' ') == "") {
return null
}
return x.join(' ')
When I run a preview it returns this string -
com.atlassian.jira.issue.history.ChangeItemBean@xxxxxxx[fieldType=custom,field=Root Cause Primary,from=,fromString=,to=1000005,toString=Business Configuration Data,created=2013-10-11 11:24:56.0]
How do I get it to return only the toString=Business Configuration Data?
The field should only show - Business Configuration Data
Thanks,
Andre
You need to transform the collection of ChangeItemBean objects to collection of String.
Here's the code:
import com.atlassian.jira.ComponentManager def componentManager = ComponentManager.getInstance() def changeHistoryManager = componentManager.getChangeHistoryManager() x = changeHistoryManager.getChangeItemsForField(issue, "Root Cause Primary").collect { it.toString } if (x.join(' ') == "") { return null } return x.join(' ')
Join PM Evangelist, Axel Sooriah, & Product Ops. Consultant & Advisor, Jenny Wanger, as they unpack the role of product ops and discuss key takeaways in Atlassian’s ‘The Product Ops Mission’ guide. They’ll answer your questions live on May 6 at 9:00am PT.
Register here ⬇️Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.