Hello,
I'd like to add a behaviour to change the value for Sprint to be empty if two conditions are met: one based on status, and another based on assignee. However, I can't seem to figure out how to reference status as a variable. Here's the code I have so far:
import com.atlassian.jira.component.ComponentAccessor
def assignee = getFieldByName("Assignee")
def assigneevalue = assignee.getValue() as String
def sprint = getFieldByName("Sprint")
def status = issue.getStatus().name // This is incorrect
def team = getFieldByName("Team")
def teamvalue = team.getValue() as String
if(teamvalue.contains("XYZ") && assigneevalue.contains("Chris")){
switch (status){
case "In Verification":
sprint.setFormValue("") // This may not be the best way of achieving empty or null - input appreciated!
break
}
}
Thanks, this helped resolve that problem around the issue variable. I now have:
import com.atlassian.jira.component.ComponentAccessor
def assignee = getFieldByName("Assignee")
def assigneevalue = assignee.getValue() as String
def sprint = getFieldByName("Sprint")
def status = underlyingIssue.getStatus().getName()
def team = getFieldByName("Team")
def teamvalue = team.getValue() as String
if(teamvalue.contains("XYZ") && assigneevalue.contains("Chris")){
switch (status){
case "In Verification":
sprint.setFormValue("")
break
}
}
This is error-free, however it is not working. The value for Sprint is retained. I also tried:
sprint.setFormValue(null)
which also did not work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.