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