Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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 :)

Suggest an answer

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

Announcing the waitlist for Jira Work Management

Hey there Cloud Community members! We’re excited to give you the first glimpse of the new home for business teams on Jira — Jira Work Management. Jira Work Management is the next generation of J...

163 views 3 7
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you