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

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Fadoua M. Boualem
Published 23m ago in Trello

Using Trello to manage events

As a Jira power user, I was at first doubtful that Trello could benefit my workflow. Jira already uses boards (ones you can customize!), so why would I even need to use Trello?! In this post you will...

31 views 2 1
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