Code for my automation

Özge Özgenç March 19, 2024

Hello,

I was trying to create an automation however I reached the maximum number of components so the automation did not work. I need help to convert this automation to JSON/JQL(?) so I can use it. 

image (1).png

I have two different fields called "priority" and "severity" according to these two fields the automation should edit the "impact" field.

This is the rule in my mind: 

IF priority="Lowest" AND Severity="Minor" THEN edit Impact="Lowest"

ELSE priority="Lowest" AND Severity="Major" THEN edit Impact="Low"

ELSE priority="Lowest" AND Severity="Critical" THEN edit Impact="Medium"

ELSE priority="Lowest" AND Severity="Blocker" THEN edit Impact="High"

 

ELSE priority="Low" AND Severity="Minor" THEN edit Impact="Lowest"

ELSE priority="Low" AND Severity="Major" THEN edit Impact="Low"

ELSE priority="Low" AND Severity="Critical" THEN edit Impact="Medium"

ELSE priority="Low" AND Severity="Blocker" THEN edit Impact="High"

 

ELSE priority="Medium" AND Severity="Minor" THEN edit Impact="Low"

ELSE priority="Medium" AND Severity="Major" THEN edit Impact="Medium"

ELSE priority="Medium" AND Severity= “Critical" THEN edit Impact="High"

ELSE priority="Medium" AND Severity="Blocker" THEN edit Impact="Critical"

 

ELSE priority="High" AND Severity="Minor" THEN edit Impact="Low"

ELSE priority=" High" AND Severity="Major" THEN edit Impact="Medium"

ELSE priority=" High" AND Severity="Critical" THEN edit Impact="High"

ELSE priority=" High" AND Severity="Blocker" THEN edit Impact="Critical"

 

ELSE priority="Highest" AND Severity="Minor" THEN edit Impact="Medium"

ELSE priority=" Highest" AND Severity="Major" THEN edit Impact="High"

ELSE priority=" Highest" AND Severity="Critical" THEN edit Impact="Critical"

ELSE priority=" Highest" AND Severity="Blocker" THEN edit Impact="Critical"



How can I make this work by adding it here?: HERE.png

I would be very appreciated if you could help me, thanks a lot!

3 answers

0 votes
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.
March 19, 2024

Hi @Özge Özgenç 

A variation of the other suggestions is to use a Lookup Table action for this need:

https://community.atlassian.com/t5/Automation-articles/New-Automation-action-Create-lookup-table/ba-p/2311333

With that, you could create keys that represent the concatenated values of the priority and severity names (as Mark suggests) and then the value would be the impact to use.

This approach would then require 2 rule components / steps, regardless of how many pairs are needed.  Extra steps could be added as a precaution in the event the priority and severity fields are not set.

Kind regards,
Bill

0 votes
Mark Segall
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 19, 2024

Hi @Özge Özgenç - You could make this a series of no more than 5 If/Else clauses using smart value conditions with the "At least one condition matches" selection.  For example your Lowest/Low impact if/else blocks would look like this:

  • IF 
    • {{issue.priority.name}}{{issue.severity}}
      Equals
      LowestMinor
    • {{issue.priority.name}}{{issue.severity}}
      Equals
      LowMinor
    • ACTION Edit Issue (Impact)
      • Lowest
  • ELSE
    • {{issue.priority.name}}{{issue.severity}}
      Equals
      LowestMajor
    • {{issue.priority.name}}{{issue.severity}}
      Equals
      LowMajor
    • {{issue.priority.name}}{{issue.severity}}
      Equals
      MediumMinor
    • {{issue.priority.name}}{{issue.severity}}
      Equals
      HighMinor
    • ACTION Edit Issue (Impact)
      • Low

Just repeat for the other 3 impact options

0 votes
Kalyan Sattaluri
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.
March 19, 2024

Hello @Özge Özgenç 

You can do an If/Else instead of just If condition and you can keep adding Else blocks as needed.

Now for the checks, I will give you first block, you can add further conditions:

If Severity contains Minor   .....&

{{#if(or(issue.Priority.name.contains("Lowest"), issue.Priority.name.contains("Low")))}}true{{/}}

equals

true

Then Edit Fields -> Impact = Lowest

See screenshot of first If block in If/Else:

image.png

 

So please refer to above screen & syntax, take a look at your rules and add further "Else" conditions and customize rule as needed.

Example:  Severity contains Minor & Priority Contains Medium / High - Impact = Low

This set up should let you complete your requirement without exhausting components.

Please try incrementally so you keep checking as you go along.

Let us know if issues. Thanks!

Suggest an answer

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

Atlassian Community Events