Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,361,987
Community Members
 
Community Events
168
Community Groups

Set Log Work Mandatory based on a select list field

Hi,

I m using the script runner and I want to make log work mandatory if select list is not empty. 

Any suggestions please.

1 answer

Hi,

For your requirement, you should look into ScriptRunner's Behaviours. 

To start, you should look at the Behaviours documentation at https://scriptrunner.adaptavist.com/latest/jira/tutorials/behaviours-tutorial.html] along with the Behaviours tutorial at https://scriptrunner.adaptavist.com/latest/jira/tutorials/behaviours-tutorial.html.

Below is an example Server-Side Behaviour code which shows how you can make the Log work field(s) mandatory:-


def required = getFieldById(fieldChanged)
def requiredValue = required.value.toString()

def logwork = getFieldById("log-work-time-logged")
logwork.required = false

if(requiredValue == "Yes") {
  logwork.required = true
}

Below is a print screen of the Behaviour configuration:-

behaviour_config.png

 

Below is a print screen of how the Behaviour works:-

behaviour_sample.pngWhen the issue is being created, if the option selected in the Required list is Yes, the Time Spent field becomes mandatory else it is not.

Hope this helps to solve your question :)

Hey, @Ram Kumar Aravindakshan _Adaptavist_! Do you know what is the name to interact with field "Work Description"? ("log-work-...?")

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Online AMA this week: Your project management questions answered by Jira Design Lead James Rotanson

We know that great teams require amazing project management chops. It's no surprise that great teams who use Jira have strong project managers, effective workflows, and secrets that bring planning ...

214 views 1 6
Read article

Atlassian Community Events