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
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)
Hi @Florian Bonniec Thanks!
I just want to warn the users, hey, you selected the same values as XYZ field contains!! that's it.
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.