Hello,
We'd like to create a validator to check if three subtasks of issue type "Contact" were created after a date in a custom field. Does anyone know if this is possible using JMWE?
For example:
If 3 subtasks of type "Contact" created after Aug 15th then allow the transition.
I know that it's possible to check the creation date of a subtask before allowing parent to transition, but not sure how to check for multiple of the same type.
Thank you for your responses!
if I understand correctly, you'd like to allow a transition only if at least 3 sub-tasks of the current issue were created after a date stored in a custom field of the current issue. Is that correct?
If so, you can use a Build-your-own condition or validator (depending on whether you want the transition to disappear or just show an error message when the transition is triggered), and use a script like:
issue.subtasks.filter(it => it.created >= new Date(issue.customfield_12345)).length >= 3
where customfield_12345 is the custom field ID of the Date/Time Picker custom field that holds the date. If that custom field is a Date Only Picker, use this code:
issue.subtasks.filter(it => it.created.toCalendarDate() >= new CalendarDate(issue.customfield_12345)).length >= 3
Could you try something like this?
!!issue.subtasks && !issue.subtasks.some(it => it.created.toCalendarDate() <= issue.dueDate)
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.