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

Method getValue() does not work on initialiser function

Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 7, 2017

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

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
Joshua Yamdogo @ Adaptavist
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 7, 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
Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 7, 2017

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

0 votes
Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 7, 2017

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.

TAGS
AUG Leaders

Atlassian Community Events