Trying to create a user report counter field

Eran Sandman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 27, 2025

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? 

1 answer

0 votes
Vishal Biyani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2025

@Eran Sandman 

Few questions

  • Is the table having 1 column?
  • Does it have a header?
  • Can you share a sample data to better understand your scenario of multiple rows in certain cell?

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.

Eran Sandman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 29, 2025

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. 

Screenshot 2025-01-29 at 13.02.24.png

Vishal Biyani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2025

Can you share the rule that you have used?

Using regular expression Lines breaks can be handled.

Eran Sandman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 29, 2025

Oh this is difficult. I tried to use ChatGPT and he gave me every time something else. Do you have a suggestion? 

Vishal Biyani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2025

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?

Eran Sandman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 29, 2025

{{issue.Description.split("\n").filter(row => row.count("|") > 1).size}}

this is the last one i tried. Assume that description = user reports

Eran Sandman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 29, 2025
{{description.split("\n").size}}

this one work for me for example. But as I said, it won't take into consideration line breaks
Vishal Biyani
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 29, 2025

@Eran Sandman 

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 

  • 2 pipes for header i.e. 14
  • 8 pipes for each row

 

Create this automation rule

snip.png

 

Set smart value variable like this:

snip.png

 

As long as your description has one table, it will work.

Let me know if it works for you

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events