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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,507
Community Members
 
Community Events
184
Community Groups

How to restrict a custom Multi-select dropdown field to be not selected with more than two values

Hi, 

I have scenario where the given multi-select custom field in create / edit screen should not be allowed to choose more than two values. 

Say the Multi-select field will have ten values listed, the user is allowed to select only two values and selecting more than two value will need to be thrown with an error before the request is getting created. 

Is there a way i can able to achieve it with Behavior plugin? 

1 answer

0 votes
Alejandro Suárez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Mar 03, 2019

Hi @Akbar N ,

You can use a Simple Script Validator:

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

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()

CustomField dosOpciones = customFieldManager.getCustomFieldObject(11111L)
def optionList = issue.getCustomFieldValue(dosOpciones).size()

optionList <= 2

Hi @Alejandro Suárez ,

 

I am getting error in this line 

def optionList = issue.getCustomFieldValue(dosOpciones).size()

 

Please advice.

 

Thanks,

Swarna 

Alejandro Suárez
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Jul 14, 2020

Hi @Swarna Radha you have to change the ID of the field to match your CustomField ID

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events