Debugging your first rule
It isn't always obvious why a rule is failing. Here are some things you can do to find out why a rule isn't behaving as expected.
1. Check the audit log
Checking the audit log is a great first port of call:
- Are there any errors displayed and, if there are, does the error offer suggestions/instructions on how to fix the problem?
- Are all the relevant fields on the right screens in Jira?
- Compare the edits in the audit log with the issue history tab on the issue page.
- If there are no entries when you were expecting some, either you haven't configured the trigger correctly or the trigger has a filter on it which isn't behaving as you expect.
2. Debugging smart-values
Use the "log action"
The Log action adds values into the audit log, including smart values. This can be really useful when you need to try out some complex smart-value functions:
Using "debug"
While the "Log action" is great, it does mean you have to insert an extra action into your rule, and you need to copy and paste your smart-values from where you actually want to use them. That means you might make a mistake!
To avoid this you can use the {{#debug}}
function. Surrounding any smart value with debug, e.g. {{#debug}}{{issue.fields.description}}{{/}}
, lets the smart value be processed as normal and also prints out the value in the audit log providing more contextual information.
Here's a working example:
When this rule now executes, the audit log will contain the following:
3. Make the testing easy & clean
- Copy the rule and disable the original before testing. This allows you to revert to the original rule easily if you make lots of changes.
- Use a manual trigger to trigger a rule from an issue at any time
- Use a scheduled trigger 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 changed.