Sub tasks being created when they should not.

Melanie_Johnson March 13, 2024

Capture 1.JPGCapture 2.JPGCapture 3.JPG

We have set up an automation for subtasks to be created.  I think we are confusing the else if and if. 4 of our subtasks are being created when they should not be and one is not being created when they should be. 

 

We have 2 if statements prior to where it is  working properly.

We then have another if which is not working properly (second photo).  It should be looking at if the issue is approved and if the employee type is not one of Contract or Temp the subtask should not be created. 

We then have an else if which should create subtasks if the issue is approved and the employee type is one of Contract or Temp. (3rd photo)

We have other subtasks which are else if's and are working properly after the above which are not working correctly.

Is anyone aware of how the if and else if works?  Is that what is causing the issue?

1 answer

1 accepted

0 votes
Answer accepted
Jehan Bhathena
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 13, 2024

Hi @Melanie_Johnson ,

Please can you elaborate what you're trying to achieve with the Automation? I.e. the use case.

While the images are helpful they don't paint the complete picture since the trigger is not visible in them.

PS: I would take the condition "STATUS is one of APPROVED" and put is as a common condition before getting into any of the IF/ELSE loops, would make your automation much easier to read. :-)

Melanie_Johnson March 13, 2024

Thank you we will have to look into the common condition as we are new to this.  Our trigger issue is when the value changes for status.  Once the status is approved there are several subtasks which are needed depending on other fields.   I have attached photos of the rule we have in place.  All the rules are working correctly except for the ones related to the employee type.  We need a task created if they are a contract or temp and we do not need tasks if they are they are contract or temp but the task will be created if they are any of the other employee typesCapture 1.JPGCapture 2.JPGCapture 3.JPGCapture 4.JPGCapture 5.JPG

Jehan Bhathena
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 13, 2024

Hi @Melanie_Johnson 

I'll thanks for the image, and the use case. I would make an automation like below to fulfill the use case:

  • TRIGGER: "Issue Transitions TO "APPROVED"
  • IF: Status = APPROVED (NOTE: this is not a IF/ELSE loop, it's a IF condition)
  • IF/ELSE:
    • IF: Employee Type = Contract OR Temp
    • ACTION: Create 1 Sub-task
  • ELSE: (NOTE: no conditions needed here since you want 4 sub-tasks for all other employees)
    • ACTION: Create 4 Sub-task

Adding a demo snapshot of what it might look like at your end (ignore the field names, since my instance has different entities as compared to your).


image.png

Hope this helps.

:-)

Melanie_Johnson March 14, 2024

THANK YOU SOO MUCH! This helped greatly!  I now understand the if and else statements.  I tested your set up and it worked.  I am going to add the many other entries into my test to ensure everything runs smoothly.  I greatly appreciate the help!

Like Jehan Bhathena likes this
Melanie_Johnson March 15, 2024

We figured it out!!  Thank you!!!!

So I thought we figured it out however the system is not doing the IF and creating the one task when we choose contractor.  Instead it is creating the 4 tasks under the else.  I am totally baffled as to why it is doing this.  if block.JPGtest 2.JPG

Jehan Bhathena
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 16, 2024

Hi @Melanie_Johnson 

You can try adding a negative condition in the Else condition i.e. Employee Type IS NOT contract or Temp.

Would also suggest checking the activity log of the automation for the issues where it incorrectly runs, this will help debugging the root cause or might help give you a clue as to which step is making the automation run.

Suggest an answer

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

Atlassian Community Events