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,551,671
Community Members
 
Community Events
184
Community Groups

Script Runner script context not working

I'm trying to use a custom field to validate a Workflow Post Function, but it's not working, does anyone know what I'm missing?

((Map) issue.fields.customfield_10084)?.value == 'Value'

 

1 answer

1 vote
Derek Fields
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.
Apr 22, 2019

You can't reference the values of a custom field this way. Try this script:

import com.atlassian.jira.component.ComponentAccessor

def cf = ComponentAccessor.getCustomFieldManager().getCustomFieldObject(10084)
issue.getCustomFieldValue(cf) == 'Value'

My jira is the clound version, I believe that I can not import anything

Derek Fields
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.
Apr 22, 2019

Sorry - wasn't paying attention. I usually work in the Server version. Try this:

issue.fields[10084] == 'Value'

No success, follow the error:

 

[Static type checking] - Cannot find matching method sr.json.issue.fields#getAt(int). Please check if the declared type is right and if the method exists. @ line 1, column 1.

Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Apr 22, 2019

Static type checking errors are warning and do not necessarily mean that it won't run.

I don't use cloud so I can't comment if this will work or not, but you should give it a try,

One idea I'm getting from reading the documentation is to try

issue.fields[10084]?.value == 'Value'

Thanks for the support Peter, but it still did not work, the answer follows:

2019-04-23 17:35:41.732 INFO - Condition didn't eval to true, exiting

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events