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 votes
Joshua Yamdogo Community Champion Dec 07, 2017

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 Join to answer
Community showcase
Teodora [Botron]
Published Thursday in Marketplace Apps

Jira Inferno: The Nine Circles of Jira Administration Hell

If you spend enough time as a Jira admin - whether you are managing a single, mid-sized instance, a large enterprise one or juggling multiple instances at once - you will eventually find yourself in ...

564 views 2 15
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot