Hi everyone.
When we open a bug ticket we have a table in the description that states information about the user who reported this issue. When another report is coming we add a new row to the user report table and add information and this can happen multiple times of course.
I would like to create a field that counts the number of rows in this table using automation. One of the challenges is that having multiple rows in a certain cell can give a wrong calculation.
Another method that I thought using but have no clue how is somehow to use JIRA forms.
Can anyone help me with this?
You can use Jira automation with a smart value to count the number of rows in the user report table. One way is to use a regex pattern in a smart value to count line breaks (\n
) within the table and adjust for headers. However, if a single cell contains multiple lines, this can lead to inaccuracies. An alternative is using Jira Forms, where each report submission updates a structured form, making it easier to count entries accurately. If Forms support automation triggers, you can increment a custom field whenever a new row is added. Let me know which approach you prefer!
Few questions
Table is stored in markdown syntax format. I am thinking this can be used for parsing and calculating the number of rows in the table.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I managed to count rows, but if for example in the info header somebody entered a long sentence and pressed enter to create a link break, it will be considered as another user report.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you share the rule that you have used?
Using regular expression Lines breaks can be handled.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh this is difficult. I tried to use ChatGPT and he gave me every time something else. Do you have a suggestion?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am assuming you would have written the automation rule in JIRA to validate that count of rows is working correctly.
Can you share your working rule, and we can go from there?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
{{issue.Description.split("\n").filter(row => row.count("|") > 1).size}}
this is the last one i tried. Assume that description = user reports
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
{{description.split("\n").size}}
this one work for me for example. But as I said, it won't take into consideration line breaks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Looking it another way as you are interested in reading number of rows in a table.
Table is represented by || for headers and | for body.
For 7 column table, there will be
Create this automation rule
Set smart value variable like this:
As long as your description has one table, it will work.
Let me know if it works for you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can I see the full flow of the automation?
I would like that when User Reports is edited that it will count the rows, and update the '# of reports' field that I will create.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Trigger
There are various triggers that can be used depending on the use case. For your requirement you can use either
IF Condition
To limit number of issues that the automation hits, you can add a JQL condition
Then create the smart value as mentioned above.
Finally, Add An Action to edit the custom field i.e. Edit Issue
Please accept the answer if the approach is working
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi! So everything worked fine, but i noticed that some of the tickets are 7 column and some 8 column. Sometimes people add a column for status.
How can I make this automation more adaptable? If there's another header then that it will take this into consideration
Another issue is:
https://app.intercom.com/a/inbox/t11tttbt/inbox/admin/1111111/conversation/111111111111?view=List
we usually post links in one of the columns. For example this specific link causes to a table of :
7h x 2r (one row is header) to be 1.25 user reports
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The reason the logic was breaking when saving links is the markdown syntax adds an extra |
Made the formula dynamic and in two steps.
Number of columns
Create a variable (NumberOfColumns) with following expression:
{{#debug}}{{#=}}{{issue.description.substringBeforeLast("||").replace("||", "~").split("~").size}} -1 {{/}} {{/}}
Number of rows
Create a variable (NumberOfRows) with following expression:
{{#debug}}{{#=}} ({{issue.description.substringAfterLast("||").replaceAll("\[.*?\]", "[]").replaceAll("[^|]", "").length}} /({{NumberOfColumns}} + 1)) {{/}} {{/}}
The formula is bit complex but if you are familiar with regex would be simple to understand.
Please test this out and let me know if you find any other edge condition
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.