In Labels field, it allows more than one label to be chosen or created & added.
Instead, wondering if there's a possibility to just allow only one label to be chosen from existing ones or create only one New label
Also, either by System " Labels " field or Custom Labels field, either way, if above limit can be set.
Thoughts & ideas, much appreciated.
TYIA
Tried below in an behavior, doesn't restrict for one label
Any thoughts much appreciated.
import com.atlassian.jira.component.ComponentAccessor; import com.atlassian.jira.issue.Issue; import com.atlassian.jira.issue.IssueManager; import com.opensymphony.workflow.InvalidInputException; import org.apache.log4j.Logger def issueManager = ComponentAccessor.getIssueManager() def labelsField = underlyingIssue.getLabels() if (labelsField.size() > 1){ log.info("Please select only one project in 'Labels' field: " + labelsField) throw new InvalidInputException("Please select only one project in Labels field") }
@Lokesh what you can possibly do is to set a condition that checks that the field has a single value. I recall doing that for the components field. That would get the work done but will cause headaches to the users because most likely they won't know why they can't transition the issue. Also, they can transition the ticket with a single value and then add a second value again so it's not the most reliable solution
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Hernan Halabi - Elite IT Consulting Group Not sure why you related transition may get impacted. Trying to understand a bit. Maybe if Component/s or Labels field is workflow validators, maybe that would be the case.
Also, wondering how do you set a condition to check for single value ?. By any groovy expression ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I recall using a condition option that checked that, no groovy expression. I believe the option said field has a single value might be part of an app. Most likely JMWE or Jira suite utilities.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, its from JMWE, but its Validator. This checks during transitions. What's required is whenever Labels field is updated for more than one value, then it should stop user. Instead, prompt with error to include only one value.
Tried something as below in an behavior, but this doesn't seem to work nor log anything.
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.customfields.option.LazyLoadedOption;
import com.atlassian.jira.issue.fields.CustomField;
import com.onresolve.jira.groovy.user.FieldBehaviours;
import com.onresolve.jira.groovy.user.FormField;
import com.opensymphony.workflow.InvalidInputException;
import org.apache.log4j.Logger
def issueManager = ComponentAccessor.getIssueManager()
def labelsField = getFieldByName("Labels").getLabel()
if (labelsField.size() > 1){
InvalidInputException Err = new InvalidInputException("Please select only one project in ' Labels ' field")
log.info("Please select only one project in ' Labels ' field" + labelsField)
throw Err
}
Wondering what's missing here !!
Any clue ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can't help you with that part, sorry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, you can't do this with labels. It's pretty much the opposite of what they were designed for.
The functionality you describe can be done though - create a custom field of type "select" - you can control the list of options and only allow one to be used (if you want to select many, use a multi-select)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Select list fields (Single or Multi select) are fixed list fields for an user and need to depend on Admin to add any new options/values
While Labels does allow for adding new options/values, it allows more than one to added into it.
Required is feature mix of both Select & Labels fields.
This may require new plugin to develop, if no other way out ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Completely agree with Lokesh.
We are sitting with the exact same UseCase.
Users need to be able to create these "On The Fly", but they are only allowed to add 1.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.