How to make field mandatory depending on specific label?
Asked by Yuval Bar Lev:

I what to make some fields mandatory when moving from one status to another(this I know how to do),   
but I want them to be mandatory only when certain label exists   
How can i do it?


Answers:
author: Bibek Behera
body: [@Yuval Bar Lev](/t5/user/viewprofilepage/user-id/5534034)

Welcome to the community. I assume you are trying to pull this off using the condition/validator in the workflow?

Could you please share an example of what you mean by "want them to be mandatory only when certain label exists"

Ideally using a screen will help.<https://confluence.atlassian.com/jirakb/map-a-screen-to-a-workflow-transition-in-jira-company-managed-projects-720634253.html>

-Bibek

comments: author: Yuval Bar Lev
body: Hi,   

example:

in Bugs, making RCA fields as mandatory when changing their status to 'ready for QA' but only when the bug has labels 'regression' \& 'staging'


author: Yuval Bar Lev
body: we have a screen pop up when changing the status that present the RCA fields   
but we want to make them mandatory


author: Bibek Behera
body: [@Yuval Bar Lev](/t5/user/viewprofilepage/user-id/5534034) I can only think of your standard bug workflow and include the below suggestion on those. \<Testing on sandbox is suggested\>

* **Edit the workflow** and select the transition to "Ready for QA".
* **Add a condition** to check if the labels contain "regression" and "staging".
* **Add validators** to ensure the RCA fields are mandatory if the condition is met.
* Use a **scripted validator** for advanced label checks if needed.
* **Publish the workflow** to apply changes.


author: Yuval Bar Lev
body: Hi  
on workflow from status A to status B  
I created 2 conditions from type VALUE FIELD, first on the field "labels" = regression and second "labels"= stg   
I chose all on the conditions list (as i want it to be both)  

then on that same workflow I created validator from type FIELD REQUIRED VALIDATOR ,  
on the field RCA != empty

but for some reason after I published i didn't have the option to move items from status A to status B as Status B didn't appear on the status list anymore

any idea why?  
should it work on basic Jira license?  

(which condition \\ validator types i should use?  
i didnt see the option to write the condition "if label exists"...)


author: Fiona Brown
body: I also need to do this. I was going to use [@Bibek Behera](/t5/user/viewprofilepage/user-id/510396)

suggestion but adding the condition to the transition will mean the transition won't be possible unless the label is on the ticket which is not what we want. This is the problem you're experiencing [@Yuval Bar Lev](/t5/user/viewprofilepage/user-id/5534034)

Are there any ways to achieve this ?


author: Yuval Bar Lev
body: [@Fiona Brown](/t5/user/viewprofilepage/user-id/3965068) try to use this suggestion   
i'm going to try it soon   

[https://community.atlassian.com/t5/Jira-Service-Management/using-power-script-condition-vaon-Jira/qaq-p/2746553?utm_campaign=mentions_reply\&utm_content=post\&utm_medium=email\&utm_source=atlcomm#M175472](https://community.atlassian.com/t5/Jira-Service-Management/using-power-script-condition-vaon-Jira/qaq-p/2746553?utm_campaign=mentions_reply&utm_content=post&utm_medium=email&utm_source=atlcomm#M175472)


author: Maciej Dudziak _Forgappify_
body: Hi [@Fiona Brown](/t5/user/viewprofilepage/user-id/3965068)

If you are open to use apps, maybe you could try Jira expression based validator. There are several options available on the Atlassian [marketplace.](https://marketplace.atlassian.com/search?query=jira%20expression%20validator)

I am from Forgappify, and we developed Jira Expression Validator, which is part of the [Workflow Building Blocks for Jira](https://marketplace.atlassian.com/apps/1233642/workflow-building-blocks-for-jira?hosting=cloud&tab=overview) free app.

The expression you need will be similar to the following:

```
issue.labels.includes('LabelA') ? issue.customfield_12345 != null : true
```

You need to change the ID of the custom field to a valid one. In the editor, after 'issue.', start typing the name of the field, and you will get suggestions with the correct value.

I am leaving a link to the [app's documentation](https://docs.forgappify.com/workflow-building-blocks-for-jira) if you are interested.

Cheers


Tags: cloud

jira-service-management

jira-service-management-cloud