Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

(Behaviour script) Make Assignee field mandatory if issue is part of (active) sprint Edited



I'm trying to achieve the above via Script Runner plugin (Behaviour). (I ignored whether the sprint is the active sprint or future sprint until I will solve this issue)

First, I tried this: (Added "Sprint" field to fields section in Behaviour & this is the server-side script)

def sprintCfVal = getFieldByName("Sprint").getValue()
def assignee = getFieldById("assignee")
if (sprintCfVal)
} else {

 But since Assignee default value is "Unassigned", assignee.setRequired(true) is meaningless here.

So I tried a different approach, trying to return an error whenever the issue has sprint value & Assignee is "Unassigned": (Added "Sprint" field to fields section in Behaviour & this is the server-side script)

import com.opensymphony.workflow.InvalidInputException
def sprintCfVal = getFieldByName("Sprint").getValue()
def assignee = getFieldById("assignee")
def assigneeVal = assignee.getValue()
if (sprintCfVal && assigneeVal == "")
def fldAssignee = getFieldById("assignee")
fldAssignee.setError("==" + assigneeVal + "==")

 If I edit an issue & add it to a sprint when it's unassigned I do get the error.

However, if I try to correct this & assign the issue to a user in the same edit screen, I still get the same error message ("====") which means he still thinks the issue is unassigned.

 I tried adding "Assignee" field to Behaviour field section and moved the previous code to be server-side script for that field but that didn't help. 

Any advice/idea about what I'm doing wrong here? 

1 answer

Hi @Asf,


Remember you only can do mandatory fields with behaviours on transition screens or edit screens, and only if that screens have the field "Assignee" (in this case).

With that in mind, you can check if the current issue is in active sprint with JQL query:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.user.UserUtils
import com.atlassian.jira.web.bean.PagerFilter

def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def searchProvider = ComponentAccessor.getComponent(SearchProvider)

def assignee = getFieldById("assignee")
def admin = UserUtils.getUser("adminjira") // Your admin user
def filter = "issuekey = ${underlyingIssue.getKey()} AND sprint in openSprints()"
def query = jqlQueryParser.parseQuery(filter)
def results =, admin, PagerFilter.getUnlimitedFilter())
if (results.issues.size() > 0){
} else {

I tried to find how to get the sprint properties with java api, but I didnt have any luck, so this may work.

Hello @Alejandro Suárez _Tecnofor_ ,

Do the behavior server side script applied on field 'Assignee' or Initialiser script work on 'Assign' Issue screen?

Best Regards,

Swapnil Srivastav

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Marketplace Apps & Integrations

Staying organized with Jira: best practices for a better project management

Project managers know this problem: A “mountain of work” lays in front of you, and you don’t know how and where to tackle them. Different to-dos lie ahead, but just one task after the other can be ha...

246 views 2 1
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