Forums

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

Can I set validation from WF if I want to check some condition?

jun lee
Contributor
February 28, 2022

Hello

 

My SW development process is that users enter "deploy approver" custom field to obtain deploy approval, and the deploy approver has to check Y/N  "deploy approval" custom field. However, there is a problem that the deploy approver does not check the "deploy approval" custom field, but the user closes the issue.


If the "deploy approver" custom field is not empty and the "deploy approval" custom field is empty, can I add verification conditions of workflow to prevent close?

 

In sum,

deploy approver field is empty -> OK

deploy approver field is not empty & deploy approver filed is empty -> NO

deploy approver field is not empty & deploy approver filed is not empty -> OK

 

Regards.

2 answers

2 accepted

0 votes
Answer accepted
Rilwan Ahmed
Community Champion
February 28, 2022

Hi @jun lee ,

We can do it by the help of Teamlead toolkit plugin for jira. 

In the workflow transtion, make use of "Conditional Field Required Validator" or the "Field Required Validator" validators based on your requirement.

jun lee
Contributor
March 7, 2022

Thanks a lot. I will try.

0 votes
Answer accepted
Sachin Dhamale
Community Champion
February 28, 2022

@jun lee ,

 

Yes you can add the workflow  condition if that field is empty then user wont allowed to close the issue

jun lee
Contributor
March 1, 2022

I want ..

deploy approver field is empty -> OK

deploy approver field is not empty & deploy approver filed is empty -> NO

deploy approver field is not empty & deploy approver filed is not empty -> OK

How should I do?

Sachin Dhamale
Community Champion
March 1, 2022

@jun lee 

If you have script runner plugin then you can write script to validate this nested condition. As by default jira does not has this nested condition validator.

You can do it for one custom field but here its a combination of two field which you need to test. 

jun lee
Contributor
March 1, 2022

@Sachin Dhamale 

 

I tried like below image, but it dosen't work. Is this because nested condition?   ENM_DeployApprover is a User Picker field.

condition.jpg

condition1.jpg

Sachin Dhamale
Community Champion
March 1, 2022

@jun lee ,

 

You need to add condition like this 

cfValues['Some Custom Field'] == 'null' && cfValues['Some Custom Field'] != 'null'

 

You can also refer snippets which is sample code

jun lee
Contributor
March 1, 2022

@Sachin Dhamale 

I added condition like cfValues['ENM_DeployApprover'] == 'null' && cfValues['ENM_DeployApprover'] != 'null'.

condition2.jpg

However error message is displayed although ENM_DeployApprove and ENM_DeployApprover are not empty. 

 

What is problem?

Sachin Dhamale
Community Champion
March 1, 2022

@jun lee ,

As per condition you need to make changes in the operator 

For ENM_DeployApprove and ENM_DeployApprover are not empty. 

cfValues['ENM_DeployApprover'] != 'null' && cfValues['ENM_DeployApprover'] != 'null'.

 

If its not work then try with 

cfValues['ENM_DeployApprover'] != '' && cfValues['ENM_DeployApprover'] != ''

jun lee
Contributor
March 2, 2022

@Sachin Dhamale 

Both ways are failed.

When ENM_DeployApprover is not empty & ENM_DeployApprove is empty, Workflow proceeded without the validation message.

Suggest an answer

Log in or Sign up to answer