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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,553,382
Community Members
 
Community Events
184
Community Groups

Scriptrunner Behavior Issue Type formvalue type

Pedro Felgueiras
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.
May 22, 2023

I found out about this weird behavior and I'm checking if this is right. 

I have the following code on the initializer of the behavior 

 

def issueType = getFieldById("issuetype")

issueType.setDescription("${issueType.formValue.class}")

 

If I'm on the edit screen I got a String, if I'm on the create screen I got a Long. 

 

is this the expected behavior?

2 answers

1 accepted

0 votes
Answer accepted
Radek Dostál
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.
May 22, 2023 • edited

When you're on Create, the issuetype "getter" won't work, it's not a regular field, per se, don't know the exact magic or logic, but..

getIssueContext().getIssueType() // to get IssueType object
getIssueContext().getIssueTypeId() // get the ID (as String, mind you)
getIssueContext().getIssueType().getName() // the pretty name

You can use these in either create or edit, and they should return reliable and consistent values. Not sure what FormField#getFormValue() returns outside of IssueContext, but the above is the way to get reliable stuff out of it.

0 votes
Graham Twine
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.
May 22, 2023

Hello @Pedro Felgueiras 

 

As Radek has mentioned, it is better to use the issueContext as per the Adaptavast behavior documentation, something to consider. On the create screen the issue does not exist in the database yet.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events