Making a field non-mandatory using ScriptRunner scripts

Tayyab Bashir Community Champion Mar 09, 2017

Hi,

I have a field mandatory in couple of projects sharing a single workflow. 
I am making this field mandatory using workflow validators on create issue screen for all these projects.

Now there is a project (ABC), and I don't want the field to be mandatory in it. 
Could someone tell me how to do that? 
How can I make an exception for that project without disturbing all the other projects?

P.S. Creating a new field configuration is not ideal for me. And would be the last approach.

Many thanks,
Tayyab 

3 answers

1 accepted

1 vote

Field configurations make  field mandatory from creation time, so I assume you're using validators because you need them optional for part of the lifecycle.  (If you need them mandatory throughout, then you absolutely should be using field configurations)

So, the simple approach - copy the workflow in use, put it in a new workflow scheme for the new project, and strip the validators out of it.

Tayyab Bashir Community Champion Mar 09, 2017

I would need to create both a new workflow and a new workflow scheme for it?

Yes, that's one of the things workflow schemes are for - to allow issues to follow different processes.

I would reccomend to use field configuration scheme beacause it garantee that after creation value for these fields will not be set to null. And these make it simpler to use the same workflow into different projects.

Tayyab Bashir Community Champion Mar 09, 2017

I created a new field configuration, but since the fields are being made mandatory using a workflow validator, I can't make them optional with the new field config, right? 

You are rigth. That is field configuration for. You have the same workflow, but different mandatory fields into different projects. 

In your case I would reccomend you to define where to reasilse logic for mandatory fields: into field config or into workflow validator.

Benefits for field config:

  • mandatory fields will not be made empty 
  • will be marked with red star on create screen
  • more flexible to use into different projects

 

Plus, with field configs, you can carry on using the same workflows.

 

If you want to use script runner plugin then You can use a behaviour section to make a field mandatory for a specific project and issue type

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

3,334 views 14 20
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot