Method getValue() does not work on initialiser function

Hi,

It seems that in the initialiser function behaviours cannot evaluate any field on view screen.

i.e. something like 

def field = getFieldById("customfield_12345")

returns null. Which prevents us doing any conditional formmating... bummer.

Best regards,

Antoine

2 answers

1 accepted

1 vote
Accepted answer

There are two problems here.

  1. Form values aren't available in initializers. You may need to use the underlyingIssue object. See open bug https://productsupport.adaptavist.com/browse/SRJIRA-2027
  2. Behaviours function on the Create Issue, Update/Edit Issue, Assign Issue, and Workflow Transition screens. They don't work on the View Issue screen. See https://scriptrunner.adaptavist.com/latest/jira/behaviours-overview.html#_screens

Hi Joshua,

One more issue about the initializer. If I edit the issue, and validate the update, the initializer runs multiple times, I do not know why. As a result, the popup appears several times, and makes the feature unusable.

Regards,

Antoine

Ah, I forgot about underlyingIssue. It actually solved my problem since I need to evaluate a custom field and add a pop-up accordingly. 

This piece of information is nice to have in mind though.

Thanks.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Statuspage

How do your teams prepare for really high (planned) traffic days like Cyber Monday?

Hi there! Shannon from Statuspage here.  👋  With Cyber Monday quickly approaching, we're looking to hear from Atlassian customers – specifically from teams who touch incident response li...

33 views 0 4
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you