Hi Team,
I have single list field called "portfolio" and values 1,2 3, 4,5 ,6 7,,8
I have projects A,B,C,D,E,F..
when Issue created in Project A, and B I need to update "portfolio" field with value 1
same project C and D I need to update "portfolio" field with value 4
......etc
I am using below script in script listener, I have not find any error but that code not working for me.
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.component.ComponentAccessor
def issue = event.issue as Issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def tgtField = customFieldManager.getCustomFieldObjects(event.issue).find {it.name == "Portfolio"}
def changeHolder = new DefaultIssueChangeHolder()
tgtField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(tgtField), "1"),changeHolder)
Hi team,
This is working for me with another code.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
def customFieldManager = ComponentAccessor.customFieldManager
def escalate = customFieldManager.getCustomFieldObjectsByName("Portfolio Alignment").first()
def optionsManager = ComponentAccessor.getOptionsManager()
def config = escalate.getRelevantConfig(issue)
def options = optionsManager.getOptions(config)
def optionToSelect = options.find {
it.value == "Cable"
}
escalate.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(escalate), optionToSelect), new DefaultIssueChangeHolder())
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.