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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

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,551,979
Community Members
 
Community Events
184
Community Groups

Sql query to get active workflows from all projects in Jira

We need to get a list active workflows with groovy scripts in their post-function

This is required to as their paths have to be modified as they will need to be moved to under - <jira home>/scripts.

Currently they are in different path & they are creating lot of warning in atlassian-jira.log as below

/secure/CommentAssignIssue.jspa [c.o.scriptrunner.runner.ScriptRunnerImpl] Add a script root for this path

To resolve this, we are required to update active workflows post-functions & move to above mentioned path.

So, we need to get list of only active workflows from all projects in Jira

Below query returns both active & inactive. Not sure if anyway to filter to retrieve active ones

select * from jiraworkflows where DESCRIPTOR like '%.groovy<%';

Any clues, appreciated.

3 answers

This will return all workflows associated with projects, and therefore active.

I wrote this for MS SQL, so you may need to adjust for your DB:

SELECT p.id AS project_id, p.pname AS project_name, p.lead AS project_lead, ws.name AS workflow_scheme,--, pc.cname AS category
wse.workflow AS workflow_scheme_associated_workflow
FROM jirauser.project p 
LEFT OUTER JOIN jirauser.nodeassociation na ON na.source_node_id = p.id AND na.sink_node_entity = 'WorkflowScheme'
JOIN jirauser.workflowscheme ws ON ws.id = na.sink_node_id
JOIN jirauser.workflowschemeentity wse ON wse.scheme = ws.id
JOIN jirauser.jiraworkflows jw ON jw.workflowname = wse.workflow
JOIN jirauser.nodeassociation nas ON p.ID = nas.SOURCE_NODE_ID AND nas.ASSOCIATION_TYPE = 'ProjectCategory'
--Find by project category
--JOIN jirauser.projectcategory pc ON nas.SINK_NODE_ID = pc.ID
WHERE DESCRIPTOR like '%.groovy%'
ORDER BY p.pname

thank you @April this was very helpful

1 vote
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2017

The script registry (Builtin Scripts -> Script Registry) will show you all the workflows where you are using scripts.

But you don't have to move them, you could just do what the log message suggests, which is to add a new root. 

You do this by adding a system property to your startup files:

-Dplugin.script.roots=/path/to/root

(or c:/path/to/root for windows)

 

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 25, 2017

You have to do it the hard way - read the workflow schemes to see if it is any of them, then read the projects to see if the workflow scheme is in use.

I would take a different approach.  Do some housekeeping, deleting all inactive workflow schemes and workflows from the "inactive" section in the UI.   Then your existing SQL will work fine because you know they're all active.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events