Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Restrict issue creation with certain symbols

Phil Evans
January 21, 2021

Hi.

I want to restrict creation of issues from portal with certain symbols in Summary and Description.

I can put Simple Scripted Validator on workflow creation with

!issue.summary.value.contains("«") && !issue.summary.value.contains("»")

and it works, but how do i use this restriction only for portal request issues creation?

Or please advise how can i use this in Behaviours?

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Nic Brough -Adaptavist-
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 Champions.
July 8, 2020

Your code is getting a list of custom fields with the name "multi user picker" and looking at the size of that list.

What you really want to do is get the current value of the field for the current issue try something like

final String customFieldName = "My Custom Field"

def customFieldManager = ComponentAccessor.customFieldManager
def customField = customFieldManager.getCustomFieldObjects(issue).findByName(customFieldName)
assert customField : "Could not find custom field with name $customFieldName"

def customFieldVal = issue.getCustomFieldValue(customField)

def numberOfOptions = customFieldVal.size()

TAGS
AUG Leaders

Atlassian Community Events