Craft a service to refresh a certain set of project-level data in JIRA. (Version dates to be specific.) Fun facts about this service:
And it's this plugin that's currently the crux of my question. I found this code snippet that explains the proper API call for the plugin, but it assumes you're calling it from a listener or post-function and not a service:
import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.comments.CommentManager import com.opensymphony.workflow.WorkflowContext import com.atlassian.plugin.osgi.container.OsgiContainerManager import org.apache.log4j.Category OsgiContainerManager osgiManager = ComponentManager.getInstance().getComponentInstanceOfType(OsgiContainerManager.class) issue.setDescription(osgiManager.getServiceTracker("com.osoboo.jira.metadata.MetadataService").getService().getMetadataValue(issue.getProjectObject(), "accounting.code"))
What I'm really looking for is some API call with this plugin that returns an object of type Project when given a custom field name and custom field value.
1. your script-snipplet should work with Groovy Runner.
2. you should ask the ProjectManager to get the Project (Project Object)
getProjectManager().getProjectObjByKey("ProjectKey") (see: http://docs.atlassian.com/jira/latest/com/atlassian/jira/project/ProjectManager.html and http://docs.atlassian.com/jira/latest/com/atlassian/jira/ComponentManager.html)
3. you can change the medatadata value (custom project field) via api call
).getService().save(issue.getProjectObject(), "accounting.code", "the new value"); (see: https://studio.plugins.atlassian.com/source/browse/JMETA/trunk/jira.metadata.plugin/src/main/java/com/osoboo/jira/metadata/MetadataService.java?hb=true)
hope this will help you out
Thanks, Andreas. We're getting there, but it's not quite what I'm looking for. My source data contains a whole list of projects. This data is tied to the data in JIRA by a metadata field called "Theme Key." Ideally, I would make an API call via JIRA Metadata to a method looking something like this:
Project getProject (String customFieldName, String customFieldValue)
My code would never need to modify the metadata only use it to find which project to update. In short, this is what I want my code to do:
Also, Andreas, by the looks of it, this guy might do the trick:
But that's only if:
Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...
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!
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