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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Scriptrunner behavior doesn't appear to execute

I have a custom field set up but I only want it to be writable if the Reporter is either an administrator or a service desk agent else it should only be readable.   It appears that my script does not execute at all.   I have added logging messages and we can't find them in any logs.   I have also tried taking out my condition to just set the field as read only and that didn't work either.   My Behavior Settings are as follows:

1.  It's associated to the proper screen in my project

2.  Not using validator plugin

3.  Guide workflow: none

4. No initialiser function

5.  Correct field is selected and option for 'ReadOnly' is checked.

 

I'm expecting the script to get the reporter and check to see if the reporter is in the Administrator or Agent groups and if so then make the field writable

 

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.security.roles.ProjectRoleManager
import org.apache.log4j.Logger
import org.apache.log4j.Level

def mylog = Logger.getLogger("com.onresolve.jira.groovy")
mylog.setLevel(Level.DEBUG)

mylog.warn("L5 : begin behavior script " )

def Reporter = getFieldByName("Reporter")
def ActualDateOverride = getFieldByName("Actual First Response Date Pick Date")

def groupManager = ComponentAccessor.getGroupManager()
def Administrators = groupManager.getGroup("jira-administrators")
def Agents = groupManager.getGroup("jira-servicedesk-users")

mylog.warn("L5 : Reporter = " + Reporter)
mylog.warn("L5 : Administrators = " + Administrators)
mylog.warn("L5 : Agents = " + Agents)

if ((Reporter in Administrators) || (Reporter in Agents))
{
mylog.warn("L5 : Setting read value to false = " )
ActualDateOverride.setReadOnly(false)
}

mylog.warn("L5 : end behavior script " )

 

 

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Apps & Integrations

🍂📹 Apptoberfest demo contest roundup: vote for your favorite demos!

Hi Community! The submissions are in (and listed below) for the 🍻🍂Apptoberfest🍂🍻 Demo Competition and it’s time for you to place your votes for the best: Analytics & reporting app demo ...

102 views 2 11
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you