How to set custom field as required up on create screen

Mohamed El Taweel April 22, 2018

Have workflow with three issue types. I need to set the filed "Service Type" to be required only if the issueType= "Shared Revenue"

 

How can I implement this request?

Example:

def rtField = getFieldByName("Service Type")
if (issue.issueTypeObject.name == 'Shared Revenue')
{
rtField.setRequired(true);


else

rtField.setRequired(false);
}

1 answer

1 vote
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.
April 22, 2018

You don't need a script for this.

Create two field configurations.  In one of them, make the field mandatory.  Use the field configuration scheme for the project to tell it to use the one with the mandatory flag for shared revenue, and the one where it is optional for all other issue types.

Mohamed El Taweel April 22, 2018

It worked properly. Thank you Nic.

Can I do it using a scriptrunner ?

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.
April 22, 2018

A behaviour could make it mandatory, but remember that behaviours are easy to bypass.

Suggest an answer

Log in or Sign up to answer