Hi, I need some pointer in setting a custom field (checkbox). For example: I have a custom field (Track flag) checkbox "Y". I need to enable the checkbox when certain conditions are met. I have the following script but it seems that updateValue is not able to do it. Please help!
import com.opensymphony.workflow.InvalidInputException
import org.apache.log4j.Category
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction")
log.setLevel(org.apache.log4j.Level.DEBUG)
log.debug "Debug Starts Here..."
log.debug "++++++"
def componentManager = ComponentManager.instance
Issue currIssue = componentManager.getIssueManager().getIssueObject("TESTDEV-787")
def customFieldManager = componentManager.getCustomFieldManager()
def trackFlag = customFieldManager.getCustomFieldObject("customfield_13601")
log.debug "Track flag = " + trackFlag
def fieldConfig = trackFlag.getRelevantConfig(currIssue)
log.debug "Field Config = " + fieldConfig
trackFlagValue = currIssue.getCustomFieldValue(trackFlag)
log.debug "Track flag value = " + trackFlagValue
if (trackFlagValue == null) {
// modifiedValue = new ModifiedValue(trackFlagValue, "Y")
// log.debug "Modified value = " + modifiedValue
log.debug "Enter into here ..."
def changeHolder = new DefaultIssueChangeHolder()
// trackFlag.updateValue(null, currIssue, setFlagValue, changeHolder)
trackFlag.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(trackFlag), "Y"), changeHolder)
}
log.debug "Debug Ends Here..."
Hi Cesare, thanks for getting back to me. I don't have access to the JIRA server to install IDEA. I only have access to the atlassian-jira.log (that's why the DEBUG statements).
I looked into the link you provided but it doesn't show me how to checkoff (enable) the checkbox (Track flag) in my case. Please be more specific. Thanks in advanced.
Hi Caleb, I was referring to my answer at that question (how to debug a script using Idea IDE). Basically you don't need to connect to the server where JIRA is, by starting atlas-debug you will also start your own JIRA instance. With that you can debug every script locally from your machine. The advantage is to have a working test environment to develop and try your scripts without be worried about rights or destroying data. In your case is useful because you can use the IDEA debugger that can give you a lot of infos about what is happening.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You may want to debug your script with an IDE like Idea. That answer may be useful for you:
https://answers.atlassian.com/questions/12266875
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.