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

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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 Behaviours global declarations in intialiser Edited

When declaring a variable in a behaviour, is it possible to declare something in the intialiser and reuse it elsewhere in the same behaviour?

For instance, I do a bunch of checks on assigned fields from a list and compares to validate content matches for certain conditioning. I'd like to reuse these fields later in the behaviour without re-declaring everything... is it possible?

An example is something like this:

def cf_ateam = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Assigned Team")
def ateam = underlyingIssue.getCustomFieldValue(cf_ateam) as String
def infTeams = ["Atlassian Administration","Systems Administration","Network Administration","Database Administration"]
def isInfIssue = infTeams.contains(ateam)

 I'd like to reuse this (isInfIssue) later in certain field behaviours. (within the same behaviour if that makes sense)


0 answers

Suggest an answer

Log in or Sign up to answer

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