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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


How to fetch the data of component using behaviour script runner

As i used validation on component (to select/restrict  to   one field only )



1st i tried this 

import com.onresolve.jira.groovy.user.FieldBehaviours
import org.apache.log4j.Logger
import org.apache.log4j.Level
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.project.component.ProjectComponent

def component = getFieldById('components-textarea')
List <ProjectComponent> result = component.getFormValue() as List

if(result.size() >1)

component .setError("Only one Component is allowed")


else {




 2 ] I tried  to get atleast size of selected element 


def c = ComponentAccessor.componentClassManager.getMetaPropertyValues()


def component = getFieldById('components-textarea')
component.setHelpText("----->>Multi Select Field is set to Support " + c.size())




Help me to put validation on component field  . My Requirement is to select only one field from System component field .


2 answers

1 vote
Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 09, 2020

Hi @Nishant Paraskar ,

you are using incorrect id for components field, it should be "components" instead of "components-textarea".

Something like this should work:

import com.atlassian.jira.bc.project.component.ProjectComponent
import com.onresolve.jira.groovy.user.FormField
import static com.atlassian.jira.issue.IssueFieldConstants.COMPONENTS

FormField componentsField = getFieldById(COMPONENTS)
List<ProjectComponent> components = componentsField.getValue() as List

if (components.size() > 1) {
componentsField.setError("Only one Component is allowed")
} else {

Excellent! Thanks

0 votes
Lee Wonnacott
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.
Nov 10, 2020


Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events