I'm trying to prevent a transition if a custom date field "Date for Removal" is not in the future. However everytime I do I get an error that says it can't find the custom field. I'm relatively new to Groovy so this is what I have thus far, any idea what I'm missing?
issue.getDateforRemoval < getDate()
You have to use the correct APIs, try this
import com.atlassian.jira.component.ComponentAccessor;
import java.util.Date;
def customFieldManager = ComponentAccessor.getCustomFieldManager();
def dateForRemoval= customFieldManager.getCustomFieldObjectByName('Date for Removal');
def removalDateValue = issue.getCustomFieldValue(dateForRemoval) as Date
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks! @Tarun Sapra
So to allow the transition if the date value is not the future it would be
Date <= getDate()
Or am I completely botching that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No it would be
Date now = new Date()
and then
removalDateValue > now
If removalDateValue is in future.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.