Hi,
I have a Field on issue creation named Start Date. I would like to create a validator that only allows dates to be set not earlier than the 1st day of the current month.
Can I please get some examples?
Cheers,
Jason
Hello,
Try like this:
import com.atlassian.jira.component.ComponentAccessor
import java.util.Calendar
def issue = ComponentAccessor.getIssueManager().getIssueObject("IM-587166")
def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Start Date")
Calendar c = Calendar.getInstance(); // this takes current date
c.set(Calendar.DAY_OF_MONTH, 1);
if (issue.getCutomFieldValue(cf) < c.getTime()) {
return true
}
return false
Hi @Jason Galea,
You can also use Workflow PowerBox add-on to solve it.
There is 2 features you can use:
- Use "Run Condition as a Validator"
- Inside the validator use "Universal Date/Time Condition".
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.