You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
I have a versionID and I want to retrieve the project's ID, name, Key, Lead, Category, etc
I retrieve the projectID with a versionID via http/REST with:
rest/api/2/version/{versionId}
I can then retrieve the other project details from
rest/api/2/project/{projectId}
... How would I go about retrieving the same information from within scriptrunner script, without using http requests?
I've tried using the ComponentAccessor's versionManager like this:
import com.atlassian.jira.component.ComponentAccessor
def ProjectManager = ComponentAccessor.projectManager
def VersionManager = ComponentAccessor.versionManager
long version = 23958
def versionObject = VersionManager.getVersion(version)
log.warn(versionObject)
...but I can't figure out how to get the projectID from the version object in this manner.
Charles,
Is this for ScriptRunner for JIRA Server?
If so, you should should be able to call getProjectId() on the Version object.
import com.atlassian.jira.component.ComponentAccessor
def ProjectManager = ComponentAccessor.projectManager
def VersionManager = ComponentAccessor.versionManager
long version = 23958
def versionObject = VersionManager.getVersion(version)
log.warn(versionObject.projectId)
Thanks Joshua!
I actually used .getProjectId() on the version object for my final script (putting that into a new variable)
Now I know to keep digging in that api doc :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No problem. If you plan to write a lot of scripts, you might consider following our "Setting up a dev environment guide"
That functionality makes it a lot easier to see which methods are available for your objects (like Version).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
How can I get "project ids" from a collection of version ids?
Its necessary use for.each ? how I can show a later out the for.each the list with projects ids ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.