TextField (Multiline) produces duplicate values [ScriptRunner]

Raynard Rhodes December 1, 2020

This custom field type produces duplicate values consistently. Any idea why this is happening?

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.issue.link.IssueLink


MutableIssue issue = ComponentAccessor.getIssueManager().getIssueObject("issueKey") as MutableIssue




def cfManager = ComponentAccessor.getCustomFieldManager()
def issueLinkManager = ComponentAccessor.getIssueLinkManager()


def jiraIssueList = cfManager.getCustomFieldObject('customfield_14104')
def jiraIssueListValue = issue.getCustomFieldValue(jiraIssueList)


//def inwardLinks = issueLinkManager.getInwardLinks(issue.id)

//ApplicationUser user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()


//IssueLink issueLink = ComponentAccessor.getComponent(com.atlassian.jira.issue.link.IssueLink)

//log.info("inwardLinks: "+inwardLinks)
//log.info("inwardLinks Type: "+inwardLinks.class)
log.info("issue list: "+jiraIssueListValue)

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.
December 1, 2020

What do you mean by "produces duplicate values"?

What are you getting and what were you expecting?

Raynard Rhodes December 1, 2020

I mean the values are showing up twice. I expect them to only show up once.

https://ibb.co/CW91RRP

 

duplicate2.PNG

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.
December 1, 2020

Where are you running the script?

Raynard Rhodes December 1, 2020

Script Console. The results are also the same when I use them in the Listener. The listener is where I'm originally using the script. If you want to reproduce the steps you can.

  1. Create a multiline textfield customfield
  2. Create an issue and populate the text field with whatever value
  3. Run the script in the console against the issue/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.
December 1, 2020

There's something odd going on here - the server I've just pasted your code into only gives one line in the log.

Raynard Rhodes December 1, 2020

I submitted a request to Adaptavist, so hopefully soon someone will pick up the ticket and we can get this resolved.

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.
December 1, 2020

I'm in a different team, but yes, poking the product team for support was going to be my next suggestion.

Suggest an answer

Log in or Sign up to answer