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

This widget could not be displayed.

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.

This widget could not be displayed.
Vasiliy Zverev Community Champion Mar 09, 2017

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? 

Vasiliy Zverev Community Champion Mar 09, 2017

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.

 

This widget could not be displayed.

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 Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

155 views 2 0
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