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

Improving Search Efficiency for Specific Jira Automation Components Across the Cloud

Martin Spernjak May 26, 2024

I am interested in how you address the issue of finding and updating a large number of Jira automation rules when a specific trigger or component no longer fits the initial solution.

In situations involving a large number of automation rules (1000+), I find it quite challenging to locate the necessary automations that contain critical components requiring updates, particularly in the event of a bug or change request.

Excluding Atlassian's support, what is the most effective method to retrieve a large number of automation rules based on specific criteria? Would it involve scripting through plugins, leveraging the REST API, or perhaps another approach?

What prompted me to initiate this topic in the first place?

The problem I'm experiencing is caused by a bug on Atlassian's part. The compare component (which deals with comparing request types) in Jira Automation no longer works as intended when the multiple language support feature is activated in Jira Service Desk. As a workaround, they need to be replaced with the JQL component instead. Which leads me to the task of going through over 1000+ automations (dozens of service desks behind), some of which consist of a large number of components (up to 65), and replacing them all with the appropriate.

1.png

Reference to Bug: Automation request type not working multiple language

Method to address this issue

Here is a concise overview of how I addressed this issue in my situation, at least to identify all the relevant rules associated with that bug.

Concept 

Export Jira Automations in JSON, then search for specific patterns using JSONPath. Once identified, compile a list of all affected automations and proceed with the necessary fixes.

Steps

The primary goal is to provide an overview of all automations and their components. In the Cloud version, I have discovered that this can be achieved through the JSON export of all rules. JSON, being a structured data-interchange format, allows us to perform certain operations efficiently, such as data search or manipulation.

1. Export All Jira Automations :
Navigate to System > Global Automation, then select Export Rules and download the JSON rules file.

2.png

2. Once you have the file, you can start searching and manipulating data. There is a wide array of tools at your disposal for processing and manipulating JSON, spanning from online platforms to desktop and command line solutions. It's important to bear in mind that your automations might involve sensitive data, so always be cautious when sharing them, especially if it entails using online tools.

In my case, I used a desktop solution in the fashion of Visual Studio Code (with extensions JSON and JSON Path).

Once inside the tool, you can easily select and open a JSON file. Right-click on "Code" and then choose the "Format Document" option. This will instantly present your JSON in a well-structured format.

3.png

So, the question arises: How can we solve the problem of searching for specific components and retrieving only the IDs of automation rules that contain these components?

Critical component in the case above is "Request Type" and it's reflected through this part of JSON.

{"selectedField":{"type":"NAME","value":"Request Type"}

To retrieve only the IDs of automation rules that contain this component, I used the JSONPath extract extension in Visual Studio Code. JSONPath is a powerful query language for JSON, enabling you to efficiently navigate through elements and attributes in a JSON document to extract specific values. With JSONPath expressions, you can precisely specify parts of a JSON document for reading or manipulation purposes.

In my case, I ran the following command in the palette to retrieve all automation rule IDs that contain affected components

$.rules[?(@.components[0].value.selectedField.value=='Request Type')].id //Return all automation rules IDs that contain component Request Type

The JSON Path syntax can be found on the GitHub and should be adjusted for the specific JSON you are working with.

Example of returned affected rule ID:

4.png

Using the returned ID, you can effortlessly access the affected automation rule in your browser by modifying the URL of an automation and updating the last part representing the rule ID.

Alternatively, you can manipulate data in JSON and subsequently import the updated automation rules back into the Cloud instance.

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events