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,359,849
Community Members
 
Community Events
168
Community Groups

Validator to match Summary with a Custom field

Hi All, 

I'd like to set up a validator that acts like if the summary matches with a single select custom field values it should warn the user and should throw the error. 

I'm looking for a scriptrunner validator to do the job. 

The single select custom field has about 500+ values. 

If the user creates an issue with anyone of the value name as a summary it should warn the user. 

Is there any possibility with Scriptrunner/other Validators? 

 

Thanks!

Prabhu

1 answer

0 votes

Hi @Prabakaran P 

SO you want to block the user if the value of the summary is an option available in a customfield or do you want to check with the selected value only ?

 

If it's the first, I don' t really see the use case but the code below should work or help at least.

Use Simple Scripted Validator and replace XXXXX with your customfield id

import com.atlassian.jira.component.ComponentAccessor

def customfieldManager = ComponentAccessor.getCustomFieldManager()

def optionsManager = ComponentAccessor.optionsManager

def customfield = customfieldManager.getCustomFieldObject('customfield_XXXXX')

def fieldConfig = customField.getRelevantConfig(issue)

List<String> options = optionsManager.getOptions(fieldConfig).stream().collect{it.getValue()}

return !options.contains(issue.summary)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira Software

An update on Jira Software customer feedback – June 2022

Hello Atlassian Community! Feedback from customers like you has helped us shape and improve Jira Software. As Head of Product, Jira Software, I wanted to take this opportunity to share an update on...

4,964 views 18 31
Read article

Atlassian Community Events