The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi folks - I am trying to update the Team field based on the value of another field however the value I get from the find is always "Null". NB - This is the "Team" field from Advanced Roadmaps that I want to update.
Please help - here is my script.
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
import org.apache.log4j.Logger
import org.apache.log4j.Level
//Set the field to be checked.
final String customFieldName2 = 'Primary Delivery Unit'
def issue = event.issue
def customFieldManager = ComponentAccessor.customFieldManager
def customField2 = customFieldManager.getCustomFieldObjects(issue).findByName(customFieldName2)
assert customField2 : "Could not find custom field with name $customFieldName2"
// Get dropdownField
def optionsManager = ComponentAccessor.getOptionsManager()
def customFieldNew = customFieldManager.getCustomFieldObject(10113)
def cfConfig = customFieldNew.getRelevantConfig(issue)
adef act_value = optionsManager.getOptions(cfConfig)?.find { it.value == 'Procurement'}
def strPDU = issue.getCustomFieldValue(customField2).toString()
log.warn("Act Value -${act_value}-")
if ( issue.issueType.name == 'Epic') {
if ( strPDU == "Business Team" ) {
customFieldNew.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(customFieldNew), act_value), new DefaultIssueChangeHolder())
log.warn("Updated team of issue ${issue.key}")
}
}
Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events