Forums

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

Field behaviour to validate reporter is in specific group

Guy LaRochelle
Contributor
May 1, 2019

Hello

I'm trying to create a field validation using behaviour, that I would like to run whenever someone changes the reporter of an issue (during creation or elsewhere in edit mode).

Basically, we need to make sure that the Reporter always belongs to a specific group.

I have tried something like the following, but without success.

//Required Imports
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.ApplicationUser

def groupManager = ComponentAccessor.getGroupManager()

// Get a pointer to the reporter field and get user
def ReporterField = getFieldById("reporter")
def ReporterValue = ReporterField.value as ApplicationUser

if(groupManager.isUserInGroup(ReporterValue, 'ReportersGroup')){
ReporterField.setError("Reporter must be in Reporters group.")
ReporterField.setFormValue(null)
}else{
// If a valid value is entered clear any errors and accept the value
ReporterField.clearError()
}

 Please help!

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
Hana Kučerová
Community Champion
February 22, 2021

Hi @erika_zanoni ,

please try this:

{{issue.customfield_10036.plusDays(7)}}

See here for documentation.

TAGS
AUG Leaders

Atlassian Community Events