Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Groovy Script to get the current project without a reference issue

Alex Sander July 30, 2024

Hi.
I need to use in a condition a script that detect the current project.
I don't have a specific reference issue to get the project, cause I need to check in filters and panels screens to.

Is it possible? 

1 answer

1 accepted

1 vote
Answer accepted
Ram Kumar Aravindakshan _Adaptavist_
Community Champion
August 1, 2024

Hi @Alex Sander

In your description, you mentioned:-

I need to use in a condition a script that detect the current project.
I don't have a specific reference issue to get the project, cause I need to check in filters and panels screens to.

Have you tried using ScriptRunner's HAPI feature?

Using HAPI, you can invoke the Projects object, iterate it and invoke the details of the project(s) you want. Something like:-

Projects.allProjects.each { 
if(it.name == "<Some Name>") {
//do something
}
}

I hope this helps to solve your question. :-)

I am looking forward to your feedback.

Thank you and Kind regards,
Ram

Alex Sander August 1, 2024

Thank's Ram, I'm going to try this option.

Ram Kumar Aravindakshan _Adaptavist_
Community Champion
August 27, 2024

Hi @Alex Sander

Has the solution I provided answered your question?

If yes, please accept the answer.

Thank you and Kind regards,

Ram

Suggest an answer

Log in or Sign up to answer