How to get status of issue in formula in JIRA Misc Custom Fields

Hi guys, 

can you please help me how to get the issue status in the <! @@Formula ?

When I use 

issue.get("status").toString(); 

I get something like COM.ATLASSIAN.JIRA.ISSUE.STATUS.STATUSIMPL ...

While I was expectiong to get "Closed" or "Open". I also failed with syntax from JIRA dev documentation

issue.getStatusObject().getSimpleStatus().getName() 

Many thanks,

Jarda

P.S.: is there any way how to debug the formula? In case it fails to compile I get the custom field empty which gives me no hint on what's wrong. Any log would help? Thank you

1 answer

1 accepted

Hi,

as stated in the documentation (as of... now), you should look inside atlassian-jira.log for errors (look at the end of the file right after displaying the issue).

In your case, you want to use:

issue.get("status").getName();

See https://innovalog.atlassian.net/wiki/x/BYAbAg for details.

Hi, I've tried to find outwardlinks where status is not closed:

    && ! issueLink.getDestinationObject().get("status").getName().equals("Closed")

 

where issuelink is an outwardLink.

 

Could you help me please, how to deal with it?

Thank you!

Here is the whole code, if it helps:

&lt;!-- @@Formula: 
import com.atlassian.jira.component.ComponentAccessor; 
import org.apache.commons.lang.StringUtils; 
DefectKeys = new ArrayList(); 
outwardLinks = ComponentAccessor.getIssueLinkManager().getOutwardLinks(issue.getIssueObject().getId()); 
for (issueLink : outwardLinks.iterator()) { 
  if (issueLink.getIssueLinkType().getOutward().equals("is Parent of") 
        &amp;&amp; ! issueLink.getDestinationObject().getStatus().getName().equals("Closed") 
    ) { DefectKeys.add(issueLink.getDestinationObject().getKey()); 
  } 
} 
if (DefectKeys.isEmpty()) return "Empty"; 
StringUtils.join(DefectKeys, ","); 
--&gt;

Thank you!

Did you look inside atlassian-jira.log for errors? 

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Jul 10, 2018 in Marketplace Apps

If you’re an Atlassian app developer, you’ll want to know about Atlas Camp!

This September 6-7, hundreds of Atlassian App developers will flock to Barcelona Spain to build skills, discover product roadmaps, meet face-to-face with the Atlassian team, and learn how to extend t...

166 views 0 4
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