I am trying to build a rule where a issue description is checked for multiple missing parts and for each missing part, a IF condition should be executed to trigger a specific comment to be added regarding that missing part.
For example:
Issue Description 1:
AAA
-
BBB
-
CCC
- Example text
In this case, I want to have 2 comments execute saying that "AAA is empty" and "BBB is empty".
Issue Description 2:
AAA
-
BBB
- Example text
CCC
- Example text
In this case, I want to have 1 comment execute saying that "AAA is empty".
I have been trying to use multiple IF statements but it seems that only the first block will execute and the subsequent blocks do not execute. So it ends up that only "AAA" is checked for missing values but if that condition passes, the remaining conditions are not checked for missing values.
Does anyone have a solution to this problem that allows me to run IF blocks in parallel on the same issue description?
Hello @dominiclau_intern
Welcome to the Atlassian community.
An alternative to @Stephen_Lugton 's suggestion is to simply set up a separate rule for each check that you want to do. As the number of items you want to check increases, your combinations for if-else-if statements will grow exponentially.
Hi @Trudy Claspill , I may try that as well, thank you for your response! There are 7 conditions that I need to check so the if-else-if approach may be indeed problematic.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @dominiclau_intern -- Welcome to the Atlassian Community!
First thing: what problem are you trying to solve by doing this? That is, "why do this?"
Knowing that will help the community offer better suggestions.
Next, your question describes parsing / checking text in the Description field for missing content, but the rule image shown is apparently checking custom fields named AAA, BBB, and CCC.
Which of these cases do you want to check: the Description or the Custom Fields?
And, if it is the Description field, is the format of your text consistent and stable enough to perform such checks?
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Bill Sheboy , thank you for your response.
I have a standardized ticket template with required sections that users must complete for proper issue documentation and workflow. Currently, users sometimes submit tickets with empty sections, which creates delays in processing and requires manual follow-up.
I am checking the Description field, the AAA, BBB and CCC fields were just placeholders.
Yes, the format is consistent and stable. I have a structured template that looks like this:
*Issue details (*In depth explanation of the issues faced)
- [content here]
*Issue Occurrence (*How does the issue occur)
- [content here]
*Affected Device*
- [content here]
...Additional Content Below...
The smart value I have been trying to use in the IF blocks to check for blank content is :
{{issue.description.substringAfter("*Issue Occurrence (*How does the issue occur)").substringBefore("*Affected Device").replace("*","").replace(" ","").replace("\n","").length}} equals 0
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for clarifying the format, and...
Please note this may a brittle solution as a person could easily "break" the template when entering the Description field. Providing them specific custom fields to enter may be better.
Regardless of that challenge, please try using text functions:
You could use either substringBetween() to find any included plain text, or match() with a regular expression. Then, trim() the result to remove any blank spacing and test the result for emptiness.
For example:
{{issue.description.substringBetween("*Issue details (*In depth explanation of the issues faced)", "*Issue Occurrence (*How does the issue occur)").trim()}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Rather than using 3 separate If matches, just use 1 and then add elseif checks e.g.
If: matches
AAA equals 0
BBB equals 0
CCC equals 0
comment: "AAA is empty"
comment: "BBB is empty"
comment: "CCC is empty"
Else-If; matches
AAA equals 0
BBB equals 0
CCC does not equal 0
comment: "AAA is empty"
comment: "BBB is empty"
Else-If; matches
AAA equals 0
BBB does not equal 0
CCC equals 0
comment: "AAA is empty"
comment: "CCC is empty"
Else-If; matches
AAA equals 0
BBB does not equal 0
CCC does not equal 0
comment: "AAA is empty"
Else-If; matches
AAA does not equal 0
BBB equals 0
CCC equals 0
comment: "BBB is empty"
comment: "CCC is empty"
Else-If; matches
AAA does not equal 0
BBB equals 0
CCC does not equal 0
comment: "BBB is empty"
Else-If; matches
AAA does not equal 0
BBB does not equal0
CCC equals 0
comment: "CCC is empty"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Stephen_Lugton thank you for the detailed response, I did not know that you could do this and is an interesting approach that I may consider implementing!
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.