Hi Folks,
I would like set a default value for Time Spent field by setFormValue function by using behaviour.
I've tried the code below but it does not work properly. Is there any suggestion?
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.CustomFieldManager;
import com.onresolve.jira.groovy.user.FieldBehaviours;
import com.atlassian.jira.issue.Issue;
import groovy.transform.BaseScript
import org.apache.log4j.Level
import org.apache.log4j.Logger
@BaseScript FieldBehaviours fieldBehaviours
String className = "tr.com.as.behaviour.OysmSetTimeSpent10Min";
Logger logger = Logger.getLogger(className);
logger.setLevel(Level.ERROR);
logger.debug ("Script " + className + " started");
def timeSpent = getFieldByName("Time Spent");
timeSpent.setFormValue("10m");
Jira Version: 8.5.4
Script Runner Version: 6.19.0
Kind Regards,
Burak
Hi,
Can you provide some extra info:
I am asking because if you want to do this kind of validation, you would have to have a "trigger" event for the validation BEFORE the issue is updated.
The update of one of these fields can not be the trigger because by then the value would already have been changed, in other words the validation would be too late.
You can do the validation when these fields are updated in transitions.
Regards,
Jeroen
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.