How to add an "elseif" condition on the workflow?

Epics with a value in a custom field need to be transitioned to the next status only by a specified group of users. If the field does not have a value anyone can transition to the next status.

1 answer


You'd need add some condition in your workflow on that particular transition. If you have ScriptRunner add-on on your instance then you can add a Simple Scripted Condition and add some code to it. 

Following code will restrict the transition, if the issue has the issuetype of Epic, it has that particular customfield present/filled out on that issue. So for such issues only users who are part of the "test" group will be able to make the transitions, if no such conditions exsist, then all the users would be able to transition the issue. 

import com.atlassian.jira.component.ComponentAccessor

// Get the CustomField by its id
def customField = ComponentAccessor.customFieldManager.getCustomFieldObject(10200)

loggedInUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

// Get the group of whose user are allowed the transition
group = ComponentAccessor.groupManager.getGroup("test")

// Get all the groups of the logged in user
groupsForUser = ComponentAccessor.groupManager.getGroupsForUser(loggedInUser)

// See if the issue is of Epic type and it has that particualr custom field
// and see if the user is part of the Groups gotten above
if (issue.getIssueType()?.name == "Epic"){
if (customField.getValue(issue)){
if (groupsForUser.contains(group)){
return true
else return false
else return true
else return true

Replace the id of the custom field you want, and also implement it on the particular transition condition that you want. 

Tayyab - My apologies for not responding sooner. We are on Jira Software cloud and I was able to sort out the logic to create what I needed in a condition.

Screen Shot 2017-11-01 at 8.46.48 AM.png

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,082 views 4 9
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