Here I have a requirement to make the Comment field mandatory when the priority is updated.
I tried the below code using behavior but it makes the comment field field mandatory when the priority is changed.
Along with this it is making comment mandatory in all the transitions of my workflow.
For example when I move the ticket to verify state we have a screen which will pop up to fill some needed values there also the comment fields has been made mandatory because of my behavior script.
If I disable the code it works fine. Here is the code which I used.
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import org.apache.log4j.Level
import org.apache.log4j.Logger
@BaseScript FieldBehaviours fieldBehaviours
def log = Logger.getLogger("sr4j.behaviour.com")
log.setLevel(Level.DEBUG)
def commentField = getFieldById("comment")
def priority = getFieldById(getFieldChanged())
def priorityValue = priority.value
if(priorityValue != underlyingIssue?.priority.getName())
{
log.debug("Required True")
commentField.setRequired(true)
}
else
{
log.debug("Required False")
commentField.setRequired(false)
}
can anyone please help me in resolving this issue
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.