Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Required field validator on subtasks when transitioning

James Valles February 12, 2018

Hi there, 

When transitioning a sub-task, which has required fields, from "draft" to "submit", validation of required fields does not work on pages other the "edit" screen.

It only works when I click on "edit" and hit "create." Then, I will get a list of required fields that need to be entered to continue. 

How can extend this type of validation beyond the "edit" screen, so that when I transition a subtask, by hitting "submit" on the view screen, it checks to make sure all required custom fields are filled?

submit.jpeg

 

I am using JIRA v7.4.0 server. I've tried adding a workflow validator to check that a specific field has been set. Problem with that, we have several subtasks. And, the validator checks the specified field even though the selected subtask doesn't include that field. 

 Thank you very much for your time.

 

 

1 answer

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 12, 2018

I guess you marked a field required in the project field configuration scheme. This setup is valid only for the create and edit screens. If you want to make fields required on a transition you should use an add-on. Kindly read the following KB

https://confluence.atlassian.com/jirakb/how-to-make-jira-applications-fields-required-in-a-workflow-transition-691011903.html

James Valles February 12, 2018

Thank you very much for your quick response. I appreciate it. 

Only thing is -- if I add a field to validate, but the field is not in the subtask, then it would be asking me to validate a required field that doesn't exist in a specific sub-task. We are using many subtasks. 

I guess the question here is - how can I check each subtask individually that all of its required fields have been filled out?

We have multiple subtasks assigned to one parent issue. And I want to transition each subtask individually and check that all of the subtask's required fields have been set. 

 ---

The 'Fields Required' validator checks whether values for specified fields are set for a given transition. If the validation fails, the transition will not be completed.

Since version 1.4.10, Σ Time Spent may be used to validate that work has already been logged once, before the current transition or within itself. And a new option has been added, to be able to ignore the context check on fields made by the plugin.

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 12, 2018

If you set a field required in the field configuration scheme then Jira will require the field even if it is not on the screen. You can have different field configuration schemes for each issue type. You can make a different field configuration scheme for subtasks and did not set the field as required there. In this case the field will be required for Tasks but it will not be required for sub tasks. 

James Valles February 12, 2018

I have set the subtasks in their own field configurations and have marked some of the fields required fields. Not sure if this is what you mean? 

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 12, 2018

I am a bit confused now. You said that you made fields required fo sub tasks and then they are not checked on transitions, right? I said that you can not create a sub task if the fields, which are required, are not provided. But you can create such a sub task? Do you mean that you can create a sub task without providing values for required fields?

James Valles February 14, 2018

I created a subtask. 

I added custom fields. 

I added custom fields that are required. 

The subtask has its own field configuration scheme. 

When I edit subtask, the validator checks to make sure that the fields have values.

HOWEVER, when I simply transition the SUBTASK from "draft" to "submitted on the VIEW SCREEN, (not the edit or create screen), it allows me to transition the issue without validating the required fields. 

I want it to check for required fields BEFORE transitioning. 

I added a field set validator on the transition on the subtask workflow.

While it works. The problem is it checks for the specified field all the time regardless of whether or not I'm trying to transition another subtask that does not include the specified field. 

I need for each of the subtasks to check to make sure all of its required fields are filled in before transitioning, just like it does on the edit and create screens. 

I hope that clears things up. 

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 14, 2018

You mean that one of the subtasks has a field and the other one does not have a field. How do you know which subtask must have the field and which subtask does not need the field? By a value in a custom field?

James Valles February 14, 2018

Thats the problem I am trying to figure out. Right now, I have marked the custom fields required under the field configuration for each subtask. Works perfectly on the edit screen. 

Since, I have many subtasks attached to an issue. I need to submit each of the subtasks before I can submit (transition) the parent issue. 

Each subtask has its own set of custom fields. I need a way for it to check if all required fields for each subtask has been filled out before submitting (transitioning). 

Right now, when I click submit, it doesn't check for required fields even though those fields are specified as required in each field configuration for each of the subtasks. 

Each subtask has its own set of custom fields. Some of the subtasks share some custom fields while others do not. 

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 15, 2018

Right, some more investigation is needed, because there's something not right here.

This bit: > I have marked the custom fields required under the field configuration for each subtask

This means that the fields on the sub-tasks must be filled in throughout the life-cycle of the sub-task.  They must be entered on create and they cannot be blanked out.

Then: > It doesn't check for required fields

It does check.  But the fields, by definition, have been filled in, because the field configuration requires them on entry and edit.  So the check always passes.

So, I'm now a little bit lost on what you are looking for?

James Valles February 19, 2018

Hi Nic, 

We actually have a custom post function that allows us to create a number of subtasks without having to fill in any fields, including the required fields when creating a parent issue. We select the subtasks we want to create when submitting the parent issue.

The problem is it lets us transition these subtasks from draft to submitted status without checking to see if the required fields are filled in correctly. 

However, if I go into the subtasks and click edit and try to update, then I get prompted to fill in required fields if left blank.

We want to check required fields not just on entry or edit, but on any screen where we are able to transition these subtasks. 

Make sense? 

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2018

You can attach a validator to the transitions and check if the required fields are not empty.

James Valles February 19, 2018

Thats great, but the problem is not all subtasks share the same required fields. So, if I have a subtask that doesn't have required fields, the validator will still check for required fields. 

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 19, 2018

Check in validator what kind of subtask you have and check the required fields for this subtask type. Basically, if you make your process complicated then you have to make complicated solutions.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events