Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira story description with table

rajvr
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!
March 28, 2025

I have a table in story description like below. I want to search the description with specific field and get the value. I tried with Match function but not able to achieve it.

Expected:

1. When string matches "ABC" then I want output as 1,2,3

2. When string matches "DEF" then I want output as 2 AM

3. When string matches "GHI" then i want string as 3 AM

Can you help me with solution

|ABC|1,2,3| |DEF|2 AM| |GHI|3 AM|

 

1 answer

1 accepted

2 votes
Answer accepted
Bill Sheboy
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.
March 28, 2025

Hi @rajvr -- Welcome to the Atlassian Community!

You appear to be asking a question about an automation rule.  Is that correct?

If so, please note context is important for the community to help.  Please post the following:

  • what type of project is this (e.g., company-managed, team-managed, etc.), 
  • an image of your complete automation rule in a single image for continuity,
  • images of any relevant actions / conditions / branches,
  • an image of the audit log details showing the rule execution, and
  • explain what is not working as expected and why you believe that to be the case.

Until we see those...

 

Let's assume you only have a single table (with markup) in your Description field.  If that was written to the rules audit log directly, it would look like this, assuming there is a header row:

||*my key*||*my value*|| |ABC|1,2,3| |DEF|2 AM| |GHI|3 AM|

Where the rows have a newline between each one.  That information may be used with the split() function, creating a list of the rows, enabling the match() function to parse them one by one.  For this scenario, the pipe | characters need to be escaped in the regular expression passed to the match().

 

For example, to get the "value" for the row with a "key" of ABC, that expression could be this:

{{issue.description.split("\n").match("\|ABC\|(.*)\|")}}

Please update the regular expression based on the actual column structure, especially when there are header rows / columns.

 

Kind regards,
Bill

rajvr
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!
March 28, 2025 edited

Thank you @Bill Sheboy

one more help.

In the same example, When string matches to "ABC" then I want to add 1,2,3 in labels. How can we achieve it?

IMG_8018.jpg

I have tried with for loop branch but it is not working.

||*my key*||*my value*|| |ABC|1,2,3| |DEF|2 AM| |GHI|3 AM|

 

Bill Sheboy
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.
March 28, 2025

Please show what you are using in the Edit Issue action to add the labels.

 

Are you trying to match multiple values with "ABC" or a single value?  For a single value, the branch should not be needed: just use the ADDREMOVE labels option and enter the smart value expression.

rajvr
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!
March 29, 2025

@Bill Sheboy

In my smart value {{test}} I have 1,2,3. I want to add three labels one by one.

Currently it is trying to add 1,2,3 as a single label.

 

IMG_8024.jpg

Bill Sheboy
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.
March 29, 2025

In that case, the found value must be split() on the commas to create a list for branching:

{{issue.description.split("\n").match("\|ABC\|(.*)\|").split(",")}}

 

Pausing a moment: what problem are you trying to solve?  That is, why do this?

The scenario you describe is sounding more and more like a contrived example, almost as if it is a question from a test.  Is that the case?

rajvr
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!
March 29, 2025

When ever there is a change in story description I want to find the string ABC from the story description and add the labels (1,2,3) to the story Labels field.

 

|ABC|1,2,3| |DEF|2 AM| |GHI|3 AM|

I tried adding split to my existing smart value but still i am not able to add label one by one. I am getting error like "The label '1, 2, 3' cant contain spaces".

I have below observations.

1. My final split is having space in between.

2. It looks like considering all 3 as a single lablel

{{issue.description.split("\n").match("\|ABC\|(.*)\|").split(",")}}

 

Bill Sheboy
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.
March 29, 2025

If you are adding the labels whenever the Description field changes, couldn't that cause prior values to remain in the Labels field?

 

Back to what you describe: updating the labels this way with an advanced branch may cause problems from multiple work item edits in a short timeframe.  It is better to perform a single edit / update using a dynamic JSON expression with advanced edit.

First some assumptions:

  • you only expect there to be one matching row for "ABC"
  • there are 1-to-many values on that row for the column

If those assumptions are valid, you could use this dynamic JSON expression to add the labels:

{
"update": {
"labels": [
{{#issue.description.split("\n").match("\|ABC\|(.*)\|").first.split(",").trim()}}
{
"add": "{{.}}"
} {{^last}},{{/}}
{{/}}
]
}
}

How that works:

  1. extract the values, as described earlier, which returns a list of values
  2. get the first one, as we only expect on value in the list
  3. split() that value on any commas found
  4. trim() to remove any surrounding spaces
  5. use that list to iterate over the values
  6. including JSON to add each label
  7. adding commas between the entries (leaving off the last one)
  8. wrapping all of that in the JSON "update"

 

Please pause to fully understand that expression, reading the documentation references, before using it in your rule.

 

rajvr
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!
March 29, 2025

@Bill Sheboy Thank you very much, it worked as expected. Yours assumptions are correct in my requirement.

Bill Sheboy
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.
March 29, 2025

Awesome; I am glad to learn it is working!  Please consider marking this question as "answered" to help others with a similar need find solutions faster.  Thanks!

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, dance, gamification, badge, razzle dazzle, team '25 anaheim

Earn a one-day badge today and do the Atlazzle Dazzle! 🕺

Today only! Share what you’re the most excited about for Team ‘25 or just dance out the beginning of a new quarter with us.

Comment the post
AUG Leaders

Atlassian Community Events