Invoice numbers and shared values
Action: Read or change a shared value (Values)
The problem
Automation variables live for one rule run. There is no counter that survives between runs and
no value that 20 rules can share, so sequential numbers like INV-2026-0042, one support address
used by many rules, or a setting changed in one place all need workarounds.
The native workaround
Keep the number in a custom field on a "config" work item: look it up, add 1, write it back. Two rules running at the same moment read the same number and both hand it out, a re-run hands out a new one, and every rule that needs the value has to look the work item up first.
With Kenshall Automation Actions
In a rule triggered by Work item created, add Read or change a shared value:
- Action: Count up (increment a counter)
- Name:
invoice-{{now.format("yyyy")}}(a new counter each year) - Once per:
{{issue.key}}(filled in by the form) - Digits:
4
Then an Edit work item step sets Summary or a text field to
INV-{{now.format("yyyy")}}-{{updatedKenshallValue.padded}}.
- No duplicates: two rules counting at the same moment get different numbers.
- Re-runs are safe: a rule that runs again for the same work item gets its number back (
{{updatedKenshallValue.reused}}is true). Numbers never repeat, but one can occasionally be skipped, so don't rely on gap-free numbering. - A shared setting: create Support hours (
09:00–17:00 CET) under Apps → Kenshall Automation Actions → Values and lock it. Every rule reads it with Get a value ({{updatedKenshallValue.value}}), and only Jira admins can change it.
Other modes: Set a value (also resets Once per) and Append text to a value, for example
collecting {{issue.key}} into a release list, once per work item.
Smart values: {{updatedKenshallValue.value}}, .number, .padded, .previousValue,
.existed, .reused, .name and .runId.
Limits: names up to 64 characters (upper and lower case are the same name), values up to 10,000 characters, about 1,000 values per site. Every rule on the site can read every value and change any unlocked one, so don't store passwords, tokens or personal data, and lock settings.
