In Jira service desk , Making custom field required based on if priority is blocker or critical Edited


I do have a requirement to make a condition so that customfield_14173 should be required if priority is set to a blocker or critical in service desk form. Am new to scripting, am not sure where to use the script and what to script. Any help us much appreciated.

 I tried this in field behavior on the custom filed to be set to required

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField

def vp = getFieldById("customfield_14173")
def priority = getFieldByName("customfield_priority")

if(priority.getValue()==("Blocker") || ("Critical"))


Any help , will this behaviour work in service desk?



1 answer

0 votes
Gaston Valente Community Champion Oct 27, 2017

KRC, did you try with an custom script validator on the create transition?

No, Will the same code be used there? 

If i use the same code in custom script validator it through java.lang errors and method errors.

No, behaviours are written in a different language than things internal to Jira.  They use javascript, conditions and other internals need to be done in Groovy or Java.

At a glance though, it's only the set-required that won't work. For a validator, you'd simply return "true" if the entry is ok, and "false" with an error message when it's not.

Thank you. Will look into it

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Jan 08, 2019 in Jira

How to Jira for designers

I’m a designer on the Jira team. For a long time, I’ve fielded questions from other designers about how they should be using Jira Software with their design team. I’ve also heard feedback from other ...

1,239 views 5 10
Read article

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