How do I make the if condition attached into an else condition under the same branch?
You cannot add IF/ELSE condition within a branch, at least not yet. What type of branch are you using?
Hi @Timi Falusi
Yes, and...to the suggestion from @Mikael Sandberg
As Mikael noted, an if / else condition cannot be used inside of a branch (although the opposite is possible).
Perhaps if you describe the problem your rule is solving (i.e., why do this) and post an image of your complete rule, that will help the community offer better suggestions including alternative rule structures. Thanks!
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.
This is what I have in full. I want it to add labels OT and US if a ticket is created between 17:00 and 22:00 UTC, else add labels OT and APAC if a ticket is created between 22:00 UTC and 8:00 UTC
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for those images and the explanation of the rule.
As you are running this daily with JQL to find work items created within specific time ranges, you could use a couple of alternative approaches:
The first approach is simpler and less likely to have errors halt the rule.
I have a couple of follow-up questions:
Why are you using the work item search endpoint with Send Web Request rather than the Lookup Work Items action and a basic JQL branch and then performing a work item edit? For the edit, is it just to suppress any notifications?
And, given the limitations of automation rules and the REST API endpoints, your rule can only process a limited number of work items. Will the JQL you are using ever return more work items than the service limits? https://support.atlassian.com/cloud-automation/docs/automation-service-limits/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes, I am using it daily with a JQL to get tickets created in a specific project with the label "Code Red". Could you give me a visual representation of what you see mean here "
I’m using the search REST endpoints via Send web request so I can first call approximate-count (to skip work when there are no matches) and then fully control the JQL and returned fields.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
First thing: as you are are already using the date / time functions, I recommend pausing to learn more about the other available functions. For example, to get the current hour as a number from 0 to 23, use the format("H") function:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/#Date-format---
Under that function, it has a link to the additional Java documentation for formats such as for hours.
If your test is regardless of the day of week, you could use a conditional expression to find the correct labels needed based upon that hour value, 0-23:
https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/
If instead you have working / non-working days and hours, you would need to first check the day of week and then the hours.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Timi Falusi
Welcome to the Atlassian community.
Please provide a screen image that shows your entire rule so we have appropriate context for your question.
Also explain to us what you are trying to accomplish with the rule.
Is the image you showed us nested under a For Each branch? i.e.
@Mikael Sandberg is correct that if you have a rule structured as above you cannot incorporate an If/Else block within a branch. But if you are not actually in a For Each branch, then to add and If/Else block to the rule you need to select that option when you are adding your condition.
You can't add an Else when you have selected a simple If condition.
After selecting an IF or ELSE condition then you will see that there is a button for adding the Else.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is what I have in full. I want it to add labels OT and US if a ticket is created between 17:00 and 22:00 UTC, else add labels OT and APAC if a ticket is created between 22:00 UTC and 8:00 UTC
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.