Forums

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

if/break or if/and conditions in jira automation

philip_song April 10, 2025

 

I have a series of "shell" tickets. These are summary issues that contain 5 sections, with each section containing 3 fields (total of 15 fields in the ticket). By default these are all empty. 

When a trigger ticket is created (Jira Form), the form contains:

-1 sections worth fields (3) 
-A text field to denote which shell tickets the information corresponds with (`shell_issues`)

I'd like to copy the data from the trigger ticket into the shell ticket with some constraints.

Here is the expected ux (sections are always filled out incrementally):

1. User submits form, and specifies ticket A
2. Jira automation looks at ticket A, sees that `Section 1` is null, and copies fields 1-3 onto `Section 1`
3. User submits another form, and specifics tickets A and B.
4. Jira automation looks at ticket A, sees that `Section 1` is not null, and sees that `Section 2` is null, and copies fields 1-3 onto `Section 2`. It then searches Ticket B, and similar to #2, copies info into `Section 1`.

 

Currently, here's what I tried:

  • Smart variable for `shell_issues`
  • Branch with JQL to loop through `shell_issues`
  • For each shell issue:
    • If Section 1 is null
      • edit issue with form fields
    • If Section 2 is null
      • edit issue with form fields

jira.png

The problem is that since all shells start empty, the first time a form is submitted, it will fill all sections.

I'm wondering if there's a way to if/and. Example `If section 2 is empty AND the section 1 field matches the field that already exists then stop`. 

 

 

Also, not to combine multiple requests into one question but I tried to put the `if` condition into the edit issue to cut down on components, but wasn't able to get it working so if anyone has ideas on that I'd love to try.

 

 

1 answer

1 accepted

2 votes
Answer accepted
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.
April 10, 2025

Hi @philip_song -- Welcome to the Atlassian Community!

I am not completely following all of the steps in your scenario, and...

You could combine your tests using smart value, conditional logic with a Smart Values Condition to test them together: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-conditional-logic/#and

 

There is another way to do this using the if / else block, but that will not work for your case as such blocks cannot be defined inside of a rule branch.  (However if you are able to invert the logic, a branch can be contained within an if / else block.)

 

Kind regards,
Bill

philip_song April 11, 2025

Hi Bill, 

I think then this works for me: {{#if(and(exists(customfield_1),not(exists(issue.customfield_2))))}}{{/}}

 

Thanks for your help and welcome!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events