How to list Automation Rules by Trigger or Action in Jira

プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。

*Fisheye および Crucible は除く

要約

This article offers an alternative to list the Automation Rules (from Automation for Jira, now bundled into Jira 9) by Project or Trigger through a query on the database.

Through the UI it's only possible to filter rules by name.


Related articles that may be of interest:


環境

Any version of Jira Data Center, Jira Software or Jira Service Management, with Automation for Jira bundled or installed as a user installed app.

ソリューション

Listing Automation Rules by Trigger

You may run this query on Jira's DB. It's written for Postgres and may require some edition to run in a different DB, like stripping of double-quotes from table names and columns — and adding the schema to each referenced table if you database's configured with such:


MySQL
select
  r. ID  as  "Rule Id", 
  r. NAME  as  "Rule name" , 
  t. TYPE  as  "Rule trigger" ,
  case when lower(t.VALUE) like '%"synchronous":true%' then 'true' else 'false' end as "Synchronous",
  p.pkey as  "Project Key" , 
  p.id as  "Project Id" , 
  au.lower_user_name as  "Rule author" 
from  AO_589059_RULE_CONFIG  r
left join  AO_589059_RULE_CFG_COMPONENT  t on t. RULE_CONFIG_ID  = r. ID  and t. COMPONENT  = 'TRIGGER'
left join  AO_589059_RULE_CFG_PROJ_ASSOC  rp on rp. RULE_CONFIG_ID  = r. ID 
left join project p on p.id = rp. PROJECT_ID 
left join app_user au on au.user_key = r. AUTHOR_KEY 
where 
  r.STATE  = 'ENABLED'
/*  and p.pkey is null or p.pkey in ('PKEYA', 'PKEYB', 'PKEYC') */
/*  and t.TYPE in ('some.trigger.key', 'another.trigger.key') */
/*  and au.lower_user_name = lower('some_username') */
order by
  r. NAME  asc, p.pkey asc;
PostgreSQL
select
  r."ID" as "Rule Id", 
  r."NAME" as "Rule name", 
  t."TYPE" as "Rule trigger",
  case when lower(t."VALUE") like '%"synchronous":true%' then 'true' else 'false' end as "Synchronous",
  p.pkey as "Project Key", 
  p.id as "Project Id", 
  au.lower_user_name as "Rule author"
from "AO_589059_RULE_CONFIG" r
left join "AO_589059_RULE_CFG_COMPONENT" t on t."RULE_CONFIG_ID" = r."ID" and t."COMPONENT" = 'TRIGGER'
left join "AO_589059_RULE_CFG_PROJ_ASSOC" rp on rp."RULE_CONFIG_ID" = r."ID"
left join project p on concat(p.id, '') = rp."PROJECT_ID"
left join app_user au on au.user_key = r."AUTHOR_KEY"
where 
  r."STATE" = 'ENABLED'
/*  and p.pkey is null or p.pkey in ('PKEYA', 'PKEYB', 'PKEYC') */
/*  and t."TYPE" in ('some.trigger.key', 'another.trigger.key') */
/*  and au.lower_user_name = lower('some_username') */
order by
  r."NAME" asc, p.pkey asc;


  • Uncomment and edit line #16 as needed to filter by Project (the p.pkey is null clause is needed to include global Rules which run for all projects).
  • Uncomment and edit line #17 as needed to filter by Rule Trigger
  • Uncomment and edit line #18 as needed to filter by Rule author

A sample output would be:

 Rule Id |  Rule name  |            Rule trigger            | Synchronous | Project Key | Project Id | Rule author 
---------+-------------+------------------------------------+-------------+-------------+------------+-------------
       1 | Hello there | jira.issue.event.trigger:created   | false       | KANBAN      |      10001 | admin
       1 | Hello there | jira.issue.event.trigger:created   | false       | SCRUM       |      10000 | admin
       2 | Rule 2      | jira.issue.event.trigger:commented | true        |             |            | admin
(3 rows)

Special attention should be paid to rules that are synchronous: they execute within the same Issue operation Thread and can delay it's execution time and response to the user/client.


To list all the Trigger Keys that are currently used by your Automation Rules, you can run the query below. You can then use any of these keys in the condition and t."TYPE" in of the 1st SQL Query:

select
  distinct t."TYPE"
from 
  "AO_589059_RULE_CFG_COMPONENT" t
where
  t."COMPONENT" = 'TRIGGER'
order by 1 asc;


You can find below the full list of Trigger Keys that exist in Automation For Jira:

jira.issue.event.trigger:deleted
jira.issue.event.trigger:updated
jira.issue.event.trigger:created
jira.issue.event.trigger:assigned
jira.issue.event.trigger:moved
jira.issue.event.trigger:transitioned
jira.multiple.issue.event
jira.issue.field.changed
jira.issue.event.trigger:commented
jira.issue.event.trigger:link
jira.issue.event.trigger:link_deleted
jira.issue.property.set.event
jira.manual.trigger.issue
jira.sprint.event.trigger:closed
jira.sprint.event.trigger:created
jira.sprint.event.trigger:started
jira.version.event.trigger:created
jira.version.event.trigger:released
jira.version.event.trigger:unreleased
jira.version.event.trigger:updated
jira.issue.event.trigger:worklog
jira.incoming.webhook
jira.jql.scheduled
jira.sla.threshold.trigger
automation.trigger.service.limit


For example, to list all the Automation Rules that are using the Scheduled trigger, you can use the SQL query below:

select
  r."ID" as "Rule Id", 
  r."NAME" as "Rule name", 
  t."TYPE" as "Rule trigger",
  case when lower(t."VALUE") like '%"synchronous":true%' then 'true' else 'false' end as "Synchronous",
  p.pkey as "Project Key", 
  p.id as "Project Id", 
  au.lower_user_name as "Rule author"
from "AO_589059_RULE_CONFIG" r
left join "AO_589059_RULE_CFG_COMPONENT" t on t."RULE_CONFIG_ID" = r."ID" and t."COMPONENT" = 'TRIGGER'
left join "AO_589059_RULE_CFG_PROJ_ASSOC" rp on rp."RULE_CONFIG_ID" = r."ID"
left join project p on concat(p.id, '') = rp."PROJECT_ID"
left join app_user au on au.user_key = r."AUTHOR_KEY"
where 
  r."STATE" = 'ENABLED'
and t."TYPE" in ('jira.jql.scheduled') 
order by
  r."NAME" asc, p.pkey asc;


Listing Automation Rules by Action

この 

MySQL
select
  r. ID  as  "Rule Id", 
  r. NAME  as  "Rule name" , 
  t. TYPE  as  "Rule action" ,
  case when lower(t.VALUE) like '%"synchronous":true%' then 'true' else 'false' end as "Synchronous",
  p.pkey as  "Project Key" , 
  p.id as  "Project Id" , 
  au.lower_user_name as  "Rule author" 
from  AO_589059_RULE_CONFIG  r
left join  AO_589059_RULE_CFG_COMPONENT  t on t. RULE_CONFIG_ID  = r. ID  and t. COMPONENT  = 'ACTION'
left join  AO_589059_RULE_CFG_PROJ_ASSOC  rp on rp. RULE_CONFIG_ID  = r. ID 
left join project p on p.id = rp. PROJECT_ID 
left join app_user au on au.user_key = r. AUTHOR_KEY 
where 
  r.STATE  = 'ENABLED'
/*  and p.pkey is null or p.pkey in ('PKEYA', 'PKEYB', 'PKEYC') */
/*  and t.TYPE in ('some.action.key', 'another.trigger.key') */
/*  and au.lower_user_name = lower('some_username') */
order by
  r. NAME  asc, p.pkey asc;
PostgreSQL
select
  r."ID" as "Rule Id", 
  r."NAME" as "Rule name", 
  t."TYPE" as "Rule action",
  case when lower(t."VALUE") like '%"synchronous":true%' then 'true' else 'false' end as "Synchronous",
  p.pkey as "Project Key", 
  p.id as "Project Id", 
  au.lower_user_name as "Rule author"
from "AO_589059_RULE_CONFIG" r
left join "AO_589059_RULE_CFG_COMPONENT" t on t."RULE_CONFIG_ID" = r."ID" and t."COMPONENT" = 'ACTION'
left join "AO_589059_RULE_CFG_PROJ_ASSOC" rp on rp."RULE_CONFIG_ID" = r."ID"
left join project p on concat(p.id, '') = rp."PROJECT_ID"
left join app_user au on au.user_key = r."AUTHOR_KEY"
where 
  r."STATE" = 'ENABLED'
/*  and p.pkey is null or p.pkey in ('PKEYA', 'PKEYB', 'PKEYC') */
/*  and t."TYPE" in ('some.action.key', 'another.trigger.key') */
/*  and au.lower_user_name = lower('some_username') */
order by
  r."NAME" asc, p.pkey asc;
  • Uncomment and edit line #16 as needed to filter by Project (the p.pkey is null clause is needed to include global Rules which run for all projects).
  • Uncomment and edit line #17 as needed to filter by Rule Trigger
  • Uncomment and edit line #18 as needed to filter by Rule author

(warning) Please note that this SQL query might return duplicate results if the same automation rule is configured with multiple actions, and each action is captured by the and t."TYPE" in ('some.action.key', 'another.trigger.key') condition in the SQL query.

You can find below the list of some action keys that exist in Automation For Jira (please note that this list might not be exhaustive, since 3rd party add-ons might add their own custom keys):

jira.issue.assign
jira.issue.clone
jira.issue.comment
jira.issue.create
jira.issue.create.subtasks
jira.issue.delete.comment
jira.issue.delete
jira.issue.delete.link
jira.issue.edit
jira.issue.link
jira.worklog.add
jira.issue.add.watcher
jira.issue.transition
jira.issue.outgoing.email
hipchat.notification
msteams.notification
slack.notification
stride.notification
twilio.notification.sms
jira.issue.outgoing.webhook
jira.sd.add.customer
jira.sd.create.request
jira.version.create
jira.version.release
jira.version.unrelease
jira.create.variable
jira.issue.deleteattachment
codebarrel.action.log
jira.lookup.issues
jira.publish.event
jira.issue.refresh.issue
jira.set.entity.property
jira.issue.archive
com.onresolve.jira.groovy.groovyrunner:execute-script-issue-action-v2

For example, to list all the Automation Rules that are using the Send Microsoft Teams message action, you can use the SQL query below:

select
  r."ID" as "Rule Id", 
  r."NAME" as "Rule name", 
  t."TYPE" as "Rule action",
  case when lower(t."VALUE") like '%"synchronous":true%' then 'true' else 'false' end as "Synchronous",
  p.pkey as "Project Key", 
  p.id as "Project Id", 
  au.lower_user_name as "Rule author"
from "AO_589059_RULE_CONFIG" r
left join "AO_589059_RULE_CFG_COMPONENT" t on t."RULE_CONFIG_ID" = r."ID" and t."COMPONENT" = 'ACTION'
left join "AO_589059_RULE_CFG_PROJ_ASSOC" rp on rp."RULE_CONFIG_ID" = r."ID"
left join project p on concat(p.id, '') = rp."PROJECT_ID"
left join app_user au on au.user_key = r."AUTHOR_KEY"
where 
  r."STATE" = 'ENABLED'
and t."TYPE" in ('msteams.notification') 
order by
r."NAME" asc, p.pkey asc;


Example of output from the example of query above:

|Rule Id|Rule name      |Rule action         |Synchronous|Project Key|Project Id|Rule author|
|-------|---------------|--------------------|-----------|-----------|----------|-----------|
|1      |Send MS Message|msteams.notification|false      |SCRUM      |10000     |admin      |





最終更新日: 2025 年 1 月 17 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.