I am using else if and following is the use case.
I use 2 tags in Parent Jira tagA or tagB. Either of these 2 tags are added to the parent jira (both can not be present at same time.) while creating the issue.
I created automation rule that does
if block
{{smart values}} condition
First value {{triggerIssue.labels.distinct()}}
condition contains
second value tagA
// Create another issue and link to parent
Else if block
{{smart values}} condition
First value {{triggerIssue.labels.distinct()}}
condition contains
second value tagB
// Create another issue and link to parent
When I add tagA to parent jira it works correct.
When I add tabB to parent jira it does not work for elseif part and Audit log says "The following work items did not match the condition: <Parent Jira ID>"
Following image is my if block
This is my else if block
When I create issue with 3rd-party-Review tag. It does match the condition and execute rest of the blocks
But for Else if condition it fails to match condition when I create issue with ProdSec-review tag
Following is the audit log for No action performed
Hi @Gaurav Pawaskar -- Welcome to the Atlassian Community!
Would you please post images of your complete rule, the conditions, and the audit log details showing the rule execution? Seeing the actual content may help explain what you are observing.
Until we see those...
Labels cannot contain duplicates, although they can contain values with different capitalization. And so using the distinct function has no impact for this scenario. What were you hoping that function would help do?
Are you trying to create the same or different work items based upon the label?
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.
Hello @Gaurav Pawaskar
Welcome to the Atlassian community.
Can you provide a screen image showing your entire rule?
Can you provide screen images showing all the details of the rule execution audit log entry?
The way an If/Else-if block works is that the first condition to match is the only branch that executes. These are either-or types of checks.
If the conditions in the initial IF block are matched, none of the other Else-if blocks will be examined.
If the conditions in the initial IF blocked are not matched, then the following Else-if conditions are examined. If those are matched, then no additional Else-If blocks' conditions will be examined.
What is it that you want to accomplish with this automation rule? Describe it in words rather than in code. Example
When I add a value to a Labels field, I want the Labels values to be reviewed and an issue created for each Labels value. However, if the labels field already has values and I add more values, I want issues created only for the new values that I added to the labels field. And I want this rule to be triggered when a new issue is created and when just the Labels field is edited.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Gaurav Pawaskar
Thank you for providing the images.
Can you show us a screen image of the issue mentioned in that Audit Log - PSOH-4300 - so that we can see the value of the Labels field?
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.
Thank for that additional image.
Your rule can be simplified by using a Work Items Field Condition rather than a smart values condition. I did that in a test rule, and the rule correctly detected the Labels value for the Else-if branch.
I believe the reason your rule is not working is because the text in the actual label is not an exact match to the value you have in the condition. The value has an upper case "R" for review, and the value you have in the compare is a lower case "r".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I checked the rule. Value I am comparing in rule is ProdSec-Review and value in label is ProdSec-Review. I do not see any casing issue here.
I am not seeing any issue. What I am missing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are correct. My mistake.
Double check if the value you are using in your comparison includes a leading or trailing space.
Otherwise I'm not sure why it would not work for you. I recreated the scenario you have using the same smart value comparison you have, and it worked for me. It also works for me to use the simpler Work Items Field Condition rather than a smart value comparison.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I converted to simpler Work Items Field Condition, as you recommended and I see the same behavior.
While you are testing can you add few more labels along with ProdSec-Review while creating issue.
So far if I have only one label "3rd-Party-Review", this is working fine but when I have "ProdSec-Review" along with more labels I am seeing issue.
This is my guess. Please check if you see same issue.
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.