Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Post function ERROR Cannot Invoke method getRelevantConfig() on null object Edited

Hi,

I added the create a subtask function to the post function. Occurs Cannot Invoke method getRelevantConfig() on null object sometimes. Is there any way to solve this problem?

The code is as follows

 

import com.atlassian.jira.component.ComponentAccessor

 

def optionManager = ComponentAccessor.getOptionsManager()

def cf = customFieldManager.getCustomFieldObjects(sourceIssue).find { it.name = '배포 Site' }

def fieldConfig = cf.getRelevantConfig(issue)

 

 

1 answer

Hi @sm_park it probably occurs when the custom field is not configured for the issue's context. Simple fix (but I would need to have more details to find out whether it is correct or not) is to not to use cf when it is null.

Can you share complete script so we can try it?

Hi, The script is as follows

 

import com.atlassian.jira.component.ComponentAccessor
import org.apache.log4j.Level
import org.apache.log4j.Logger

def log = Logger.getLogger("com.curvc")

def optionsManager = ComponentAccessor.getOptionsManager()
def cf = customFieldManager.getCustomFieldObjects(sourceIssue).find {it.name == "배포 Site"}

def fieldConfig = cf.getRelevantConfig(issue)
def acheck = optionsManager.getOptions(fieldConfig).getOptionForValue("Seosan",null)
issue.setCustomFieldValue(cf,[acheck])

def level = customFieldManager.getCustomFieldObject(14416L) // 요청 Site
def levelvalue = sourceIssue.getCustomFieldValue(level).toString()
def deploytype = customFieldManager.getCustomFieldObjects(issue).find {it.name == '배포유형'}

def fieldConfig1 = deploytype.getRelevantConfig(issue)

log.debug("요청site : "+levelvalue)
log.debug("배포site : "+acheck)
log.debug("배포유형 : "+deploytype)

if(levelvalue == "Seosan"){
def acheck1 = optionsManager.getOptions(fieldConfig1).getOptionForValue("Base",null)
issue.setCustomFieldValue(deploytype,acheck1)
}
else{
def acheck1 = optionsManager.getOptions(fieldConfig1).getOptionForValue("확산",null)
issue.setCustomFieldValue(deploytype,acheck1)
}

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you