IF condition does not find labels that are inserted on trigger issue
Asked by Jason M_:

Hello,

Can someone help me understand why the following rule structure is not matching the IF condition for existing labels, when the trigger issue is adding the labels (as created from smart variables)?

1. Description: where regex extracts values after strings, such as **New Trunks:**and assigns to variable {{newTrunks}}

2. Edit issue drops those smart variables as Labels on the trigger issue. Labels are same as variables, in this case "newTrunks"

3. Issue shows label "newTrunks" after created.

4. IF condition: If label contains "newTrunks", then create a ticket. However, each run automation gives the message:

##### IF BLOCK {#toc-hId--1566570566}

The following issues did not match the condition:  
JOF-365  
![rule.png](https://community.atlassian.com/t5/image/serverpage/image-id/248304i0A4FFC252EFF75DA/image-size/large?v=v2&px=999 "rule.png")![ticket.png](https://community.atlassian.com/t5/image/serverpage/image-id/248305i0D54294405A5CEDB/image-size/large?v=v2&px=999 "ticket.png")  
What am I missing here??  
Thanks!


Answers:
author: Bill Sheboy
body: Hi [@Jason M_](/t5/user/viewprofilepage/user-id/2885406)

I am not quite following what you are trying to test...is it:

* you want to check for a label value named "newTrunks", or
* you want to check for a label matching the contents of the created variable {{newTrunks}}

And one more thing...When using basic conditions, the rule only continues if the test passes. If instead you have multiple possible conditions, you may want to use the if/else structure, such as the following:

* if/else condition
  * some condition test...
  * some action...
* else/if
  * some other condition test...
  * some action...
* else
  * some action

Kind regards,  
Bill

comments: author: Jason M_
body: Hi Bill,

Thanks for your response, to clarify I'm looking to match the contents of the created variable {{newTrunks}}, which equals the string "newTrunks", and that is added to the label field.

From my screenshot of the rule above, that label field is updated in the component right before the *If:matches* condition that is failing.

I can see the label field is updated with the word "newTrunks" in the trigger issue, yet the *If:matches* condition still fails to find the label.

I do know the basic condition will fail the remainder of the rule, and am using if/else components to get around that...but here I'm focused on why the condition is not finding the label.

Thanks!  
Jason


author: Bill Sheboy
body: Gotcha, and thanks for clarifying.

When a rule triggers with an issue, the data remains in the as-triggered state even when issues are written out to the cloud/server. When you want to refresh after an edit, add a [Re-fetch action](https://support.atlassian.com/cloud-automation/docs/jira-automation-actions/#Re-fetch-issue-data) before proceeding.

This works for rules with a simple flow...branches that could be on more than one issue have a different behavior. I cannot tell from your rule image excerpt if that applies to your situation.


author: Jason M_
body: Awesome, that did the trick! Thanks for the explanation as well, much appreciated!


Tags: label