Is there a way to show , which sub-tasks custom fields are not filled as a validation message in the workflow validations, we are currently using Scripted (Groovy) Validator (JMWE add-on).
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import org.apache.log4j.Category
import com.opensymphony.workflow.WorkflowContext;
import com.atlassian.jira.config.SubTaskManager
import com.opensymphony.workflow.InvalidInputException
SubTaskManager subTaskManager = ComponentAccessor.getSubTaskManager();
Collection subTasks = issue.getSubTaskObjects();
def Issues = "Please update the Below subtasks Statuses \n"
if (subTasks.isEmpty())
return false;
for (currIssue in subTasks)
{
if(issue.getStatus().name != "In Progress")
Issues = Issues + currIssue + ","
else
return true;
}
return Issues;
invalidInputException = new InvalidInputException(Issues)
But the issue is we are calling status, but instead need to check custom mandatory fields in the subtasks, if they are empty. the name or the key of the sub task should display in the validation. Is it possible?
The above code is also not working properly
you can also use this for reference (Using JWT)
Hi,
you probably want something like this:
def subtaskKeys = []
issue.subTaskObjects.each { subtask ->
if (!subtask.get("Field 1") || !subtask.get("Field 2"))
subtaskKeys += subtask.key
}
if (subtaskKeys)
return "Please update the following subtasks: " + subtaskKeys.join(", ")
return true
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.