It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Read project metadata in a workflow Edited

We are evaluating the plugin and want to use the setting of project metadata in a workflow condition and/or scripted validator.

Does anybody have groovy code that works with Jira 7.2+ that reads the value of a given key?

2 answers

1 accepted

Hi @Martina Riedel,

Please take a look at this similar question.

How to get metadata in groovy postfunction?

Thanks that was the post I couldn't find, got in working and pared down

The following works in a ScriptRunner script

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor

def projectObject = issue.getProjectObject();
Issue myIssue = issue // needed for the getClass to work
// get named project metadata key, ignore the static checking error below, it works
def myKey = ComponentAccessor.getComponentOfType(myIssue.getClass().getClassLoader().findLoadedClass("com.atlassian.jira.plugin.JiraOsgiContainerManager")).getServiceTracker("com.osoboo.jira.metadata.MetadataService").getService().getMetadataValue(projectObject, "Key")

Suggest an answer

Log in or Sign up to answer
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published Apr 03, 2019 in Marketplace Apps

How to estimate projects more accurately?

Gaining insight into your team’s effectiveness and choosing the right estimation technique.   Estimating projects is hard. It is because people have the tendency to underestimate the time thin...

280 views 2 8
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