jira automation - get started
Asked by Oliver Berger:

Hi All,

during the last couple of days, i created some jira automation rules, so i have some questions.

Is there any more comfortable way, than using the builtin debugger? maybe a vs code extensions with syntax highlighting and syntax checking and help and stuff?

is there a nice way to share code snippets with the community?

Is there a way to participate in improving the existing documentation?

Thanks Oli


Answers:
author: Nic Brough -Adaptavist-
body: I'm afraid the built-in editor is the only option at the moment.

Really good idea for an IDE plugin though!

comments: author: Bill Sheboy
body: Hi [@Oliver Berger](/t5/user/viewprofilepage/user-id/1439673)

Yes, and...to Nic's ideas:

Here is the Atlassian library of example automation rules, and I have seen their product people posting about perhaps having a similar library for the community members to share rules. No timelines were noted on doing that.

* [https://www.atlassian.com/software/jira/automation-template-library#/rule-list?systemLabelId=all\&page=1\&pageSize=20](https://www.atlassian.com/software/jira/automation-template-library#/rule-list?systemLabelId=all&page=1&pageSize=20)

Until then...often community members add posts/discussions to share ideas, like these ones:

* <https://community.atlassian.com/t5/Automation-discussions/What-is-your-most-useful-automation-Here-is-mine/td-p/1560668>
* <https://community.atlassian.com/t5/Jira-articles/%EF%B8%8F-Jira-July-Share-your-automation-hacks/ba-p/1738652>

For the last question about participating in improving documentation, I recommend when you find a page with problems, use the "Provide feedback on this article" link at the bottom to offer suggestions. I find the team responds well when specific things are raised.

And, there are open suggestions to make the documentation more comprehensive, perhaps like the REST API information. Here is a suggestion I submitted along those lines: <https://jira.atlassian.com/browse/JIRAAUTOSERVER-103>

Kind regards,  
Bill


author: Oliver Berger
body: Thanks [@Nic Brough -Adaptavist-](/t5/user/viewprofilepage/user-id/781454)[@Bill Sheboy](/t5/user/viewprofilepage/user-id/1685313) for your answers.

I think, i do not need to loose any words on the quality of the built-in editor.

The template library is "nice", but if you are dealing with smart values, it is not very helpful.

Something like this would be easy to use from my PoV. But a common tag is the key to make this work.

[https://gist.github.com/search?q=%23jiraautomation+changelog\&ref=searchresults](https://gist.github.com/search?q=%23jiraautomation+changelog&ref=searchresults)

Also added a vote to your issue, and provided some feedback on the page. Maybe someday there will be an "else" mentioned in the "if" documentation...

Cheers Oli


author: Darryl Lee
body: Hi [@Oliver Berger](/t5/user/viewprofilepage/user-id/1439673) - I've been meaning to write something up about my experiences exporting rules as JSON and then treating them as code.

As I wrote [here:](https://community.atlassian.com/t5/Jira-articles/%EF%B8%8F-Jira-July-Share-your-automation-hacks/ba-p/1738652#M4947)

* Rules are formatted as JSON, which is a tool for storing/presenting data in a human-readable format.
* There are lots of tools/libraries for parsing/manipulating JSON files.

Minimally, if you just run your rule(s) through **jq** to apply some light formatting, it's actually quite manageable to edit the JSON in any code editor. (I actually went so far as to use a templating system to programmatically create rules where a Checkbox Field's options were mapped to specific Assignees.)

Unfortunately actually testing and debugging manually hacked JSON rules requires importing the rule back into Jira and running it.

For particularly complex rules, you could check the formatted JSON into a source control system like Bitbucket, and even if you use the editor, there's still value in exporting again and checking-in the JSON to track changes, etc.

I've \*ALMOST\* found an endpoint for exporting all of the rules:

<https://MYSITE.atlassian.net/gateway/api/automation/internal-api/jira/SOMEHASHEDKEY/pro/rest/GLOBAL/rule/export>

(That's from looking at the Export link from the menu here: [https://MYSITE.atlassian.net/jira/settings/automation#/rule-list?systemLabelId=all\&page=1\&pageSize=20](https://MYSITE.atlassian.net/jira/settings/automation#/rule-list?systemLabelId=all&page=1&pageSize=20))  

So with that in hand, assuming you could get an API key that Atlassian would accept, you might be able to***automate***a mechanism to "snapshot" your rules on demand, or on a schedule, and then check those into a repo for tracking.

comments: author: Darryl Lee
body: I wrote the long article. It's here:  
[Hacking/Parsing Automation Rules with JSON for Fun and Profit](https://community.atlassian.com/t5/Automation-articles/Hacking-Parsing-Automation-Rules-with-JSON-for-Fun-and-Profit/ba-p/1984033)


Tags: cloud