Debugging your first rule

When you're getting started, it isn't always obvious why a rule is failing. Here is a guide to what we do when trying to debug why a rule is not behaving as expected.

1. Check the audit log

We always try to capture problems in the audit log. This should always be the first port of call.

  • Are there any errors displayed?
  • Do they provide instructions on how to fix the problem?
  • Are all the relevant fields on the right screens in Jira?
  • Can you click through to the component and fix it?
  • Compare the edits in the audit log with the issue history tab on the issue page.

Debug with audit log

If there are no entries when you were expecting some, either you haven't configured the trigger correctly or there is some nastier bug at play.

2. Use the "Log action" or "Debug function"

We are always doing this. The Log action will render any value (including smart-values) into the audit log. This is great when you are trying to debug smart-values and you aren't sure what they are outputting.

Debug with log action

You can also surround any smart-value with a debug function. E.g. {{#debug}}{{now}}{{/}} This will let the smart-value proceed as normal but also print out the value in Audit Log.

3. Make the testing easy & clean

Some other great tips:

  • Copy the rule and disable the original before testing. This allows you to revert to the original issue if you make lots of changes.
  • Use Manual triggers to easily trigger rules from an issue.
  • Use Schedule triggers and simply click the "Run rule" button to trigger the rule for testing.
  • Use {{now}} to include the current time in your your smart fields. e.g. description. This allows you to see when the edit was made and if the value changes.
  • When debugging embedded smart-values, break out each part and print that out using the Log action.

Other add-ons not playing nicely

We have recently seen a lot of support cases where 3rd party add-ons are causing problems in Automation. They can throw errors while handling events or while serializing an issue (we need to convert the issue to JSON to push it through the Automation engine). Calculated custom fields can also cause performance issues. Some add-ons we've seen cause issues are:

  • ScriptRunner
  • Jira Suite Utilities
  • Jira Misc. Customfields
  • Powerscript

If you are seeing issues around performance or rules not running and you have any of these add-ons installed, try disabling them to see if the problem goes away.