I thought i might be able to use validators to ensure that i can enforce the existence of a subtask before an issue (story type) reaches a particular step in the workflow.
However the ADD VALIDATOR option is limited to 3 options below.
- Complete Session Validator Validates that all Bonfire test sessions related to this issue are complete.
- Permission Validator Validates that the user has a permission.
- User Permission Validator Validates that the user has a permission, where the OSWorkflow variable holding the username is configurable. Obsolete.
How do i get about creating a custom validator, and can the validation 'subtask must exist' be created? (ps: i checked conditions, but all conditions checks is the status of a subtask, so that if no subtask exists, status cannot be checked)
I have a very similar validator implemented, but is not the same case. In my case the validator check if the task (have subtasks AND they are all closed ) OR ( no subtasks at all).
Try searching in marketplace, it seems a pretty common use case and you can get this done.
Or, you can create a plugin as a workflow validator, to check if there are subtasks. The code is somewhat like:
public class CheckSubtastks implements Validator { public void validate(Map transientVars, Map args, PropertySet ps) throws InvalidInputException, WorkflowException { boolean validate = false; Issue issue = (Issue) transientVars.get("issue"); int subtareas = issue.getSubTaskObjects().size(); if (subtareas == 0) { validate = false; throw new WorkflowException("Define some subtasks to go ..."); } } }
thanks guys,
i am so impressed by the quick feedback, so many times i got stranded with Atlassian generic answers, that totally beats it.
i am usually a bit dubious about finding 'solutions' to my issues on marketplace, but with the reassurance that it might be a common use case, i downloaded https://marketplace.atlassian.com/plugins/com.fca.jira.plugins.workflowToolbox.workflow-toolbox and that particular use case was in there, so that i didn't have to code at all!
Happy :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ps: might not work for everyone as it is a paid solution, however i am on a community license, so that is good enough for me
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Laurence,
Through this plugin guide you can create your custom validator plugin :
in the validator , you can have your own logic of validation.
Another important: condition is basically used for user permission (through these we can specific who all can see the transition).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are on the right track - that's exactly what validators are for.
However, Jira does not ship with very many of them. Most of us install add-ons to get some of the more basic validators (that really should be included in the core in my humble opinion) - the Jira Suite utilities is the one I usually reach for first. There are a lot of other validators in the marketplace too.
If you can't find one that matches, then you'll need to write one. I do this in two ways:
1. Write one as a plugin
2. Add the script runner add-on - it provides a framework that saves you having to write all the structure around your own plugin, you can get stuck straight into the code.
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.