Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,294
Community Members
 
Community Events
184
Community Groups

Update of Advanced Roadmaps Team field via listener

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}")
}
}

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events