Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,297,994
Community Members
 
Community Events
165
Community Groups

Need list of projects linked to any workflow

Edited

Need list of projects linked to one workflow. 

I have checked the Administration -> Workflows -> Open workflow  Shows the list of associated workflows -> It also shows hidden projects and i cannot render the list from there 

I have also checked for any built in scripts in script runner , but was not a successful 

I was not able to find any existing REST API for the same . 

Note: My environment doesn't allow installing any new plugins 

Please suggest 

6 answers

if you have a scriptrunner, you can execute this piece in console :

import com.atlassian.jira.component.ComponentAccessor

def projectManager = ComponentAccessor.projectManager
def workflowManager = ComponentAccessor.workflowManager
def workflowSchemeManager = ComponentAccessor.workflowSchemeManager

def wfName = "GSEP Template Task Workflow"
def allProjects = projectManager.getProjectObjects()
allProjects.findAll { project ->
def scheme = workflowSchemeManager.getWorkflowScheme(project)
wfName in workflowManager.getWorkflowsFromScheme(scheme)*.name
}*.key

basically goes through all projects and checks if the workflow with such name is in its scheme

change "key" in a last row to "name" if you want list of project names, not keys

Hello , 

Im getting the attached message 

Capture4.PNG

again, it's not really a error. 

the real error won't allow the script to work at all, but it works and returns empty list, which means that either the name of workflow I put there is incorrect and you have to manually edit it or that there is something drastically different between our jiras.

Hello IIya , 

Thanks i was able to run this script and its working , it seems like there was a extra space in my workflow . 

Thanks for all your help  

Thanks Ilya , 

I have tried running the Script above , Im getting this as the result  , Can you help me out here . Capture2.PNG

this warning is about using a deprecated method (still works though)

maybe, try copying and pasting the name of you workflow here (since i took it from a screenshot and might have mistyped something):

def wfName = "GSEP Template Task Workflow"

aight, rewritten it a bit without using deprecated methods

maybe your jira version is newer than mine so for you those just dont work

try this (again, make sure you put proper workflow name in it):

import com.atlassian.jira.component.ComponentAccessor

def projectManager = ComponentAccessor.projectManager
def workflowManager = ComponentAccessor.workflowManager
def workflowSchemeManager = ComponentAccessor.workflowSchemeManager

def wfName = "GSEP Template Task Workflow"
def allSchemes = workflowSchemeManager.assignableSchemes
Set f = []
allSchemes.each {
if (wfName in it.mappings.values()) {
f += workflowSchemeManager.getProjectsUsing(it)
}
}
f*.key
Like # people like this
Like Nir_K likes this

Go in the  Workflow schemes page.

I have tried that .

When clicked on the Workflow to check the Projects Linked to one workflow so when viewing it shows me that some of them are hidden  

Please find the snapshot . 

How do i find which are these hidden projects , I have more than 100+ Workflows and 500+ Projects 

Capture.PNG

0 votes
Deleted user Jun 12, 2019

Hi @Jennifer Lobo ,

 

To know the list of the projects that are using the same workflow: Navigate to the workflow section from the Administration section -> Issues -> click on the view of any workflow -> As shown in the below screenshot you can see a USED BY option at the top which will give you the list of workflows that are using the respective workflow.

 

community11.png

 

community12.png

 

Hope this helps you and not require any third-party add-ons.

 

Regards,

Sravya

How do you see the hidden projects if there are more than 15 using a workflow.  If that workflow is being used by several schemes, it's not helpful to look up schemes.

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you