Forums

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

Automation rule condition - Match on text values located on several rows?

N Holm November 23, 2023

Hello,

Is it possible to match on data that is present on several rows in a text field?

Example:
Description field has the following data:
"Is it A or B?
B"

The Component "New Condition/Issue fields condition" seems to be only single lined and doesnt support multi line information?

Edit: (more information added)
I want to set a specific label to issues that has a certain value in the description field.
The problem for me is that the value im looking for is also presented in the description field from the form the user filled in so i cant match on only the word because thats already present in the form.

The description field looks like this:
"Is it A1 or B2?
B2

Have you tried C3 or D4?
D4"

The user in the above example has filled in "B2" and "D4" and i want to set the label on the issue based on that the user filled in "B2" in the issue.

I also dont want to edit the layout of the description, i want it to be formated the same way as it was then the issue was created.

 

 

2 answers

0 votes
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.
November 23, 2023

Hi @N Holm -- Welcome to the Atlassian Community!

Do you care about any of the embedded newline characters in your search results?

If not, you can help the match() function by first splitting on newline.  For example:

{{issue.description.split("\n").match(your search expression)}}

Kind regards,
Bill

N Holm November 24, 2023

Hi Bill, 
Thanks, i filled in a bit more information in the orginal question if that helps understanding my challenge.

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.
November 24, 2023

Thanks for that additional information.

The challenge with this scenario is the description field needs to be stable enough to create a match() expression to check it.

Let's assume your description also contains the questions, as you show, and that each one always ends in a question mark.  The first step of the parsing to could be to remove all lines which end in a question mark.  Better still, if there is a prefix and suffix, that will help.  For example:

Question: Is it A1 or B2?
B2

Question: Have you tried C3 or D4?
D4

That will improve the accuracy of removing the questions before checking for the answers.

0 votes
Danyal Iqbal
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.
November 23, 2023

you could replace all new lines with a control character and than match with a regex e.g

{{issue.description.replaceAll("(\n)","control_Character").replaceAll("(\s+NEWLINE)","NEWLINE").match("Startstring (.*)Endstring:").replaceAll("(NEWLINE)","\n")}}.

you may want to experiment with \r\n as well and the regex depending on what you want (e.g do you want the text or do you just want to check for specific string.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
TAGS
AUG Leaders

Atlassian Community Events