Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

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

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

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 Nirmani_Kalakheti likes this

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  

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

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

Go in the  Workflow schemes page.

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