Automation to collect details to create release notes when a fix version is deployed

John Maner September 7, 2023

Background 

I, a very green Automation user, am trying to use the Jira Automation plugin to gather details from issues and send them to different email distributions which are based on a component in the issue. 

For context, we have a few different api's utilized by different clients. E.g., flavor 1 is utilized by clients A, B, and C, flavor 2 is utilized by clients D, E, F. When we release a version with changes to flavor 1 I want to collect the value from a custom property and send them in an email to a distribution which contains info for clients A, B, C. I would like it if the automation could do this for N (well, up to 200 since I would like to use the lookup table), flavors. It seems like I could get around this by instead creating N different rules for each specific flavor, but this quickly becomes tedious to maintain. 

 

Based the on actions I have available, I want to be able to do the following. 

  • When: Version released
  • Then: Create lookup table with keys that correspond to the api flavor and values that correspond to the email distribution for that group of clients. 
  • For each: api flavor 
    • If count of issues in this version > 0 
    • then send email to email distribution for api flavor (based on value in lookup table) with subject of version and content is a bulleted list of the custom property of the change summary  

The Problem (in my understanding, or a limitation?) 

 

Are we able to loop over the Key in a custom lookup table? 

Are we able to access the corresponding Value in a custom lookup table while using a branch/loop? 

Is this approach even feasible??!! Am I really better off just creating N individual rules to handle this? 

 

My Attempt 

When: Version released 

Easy enough... fix version.PNG

 

Then: Create lookup table 

Easy enough... 

create lookup table.PNG

For each: Smart Value 

How can we iterate over the key a lookup table? 

branch on lookup table..PNG

Assuming we can, we will proceed... 

Then: Lookup issues 

Gather all issues using lookup issues JQL where apiflavor property is our custom apiFlavor smart value we are trying to iterate over, and the issue is in our version. Should probably also include a filter for ticket status and resolution... 

lookup issues.PNG

 

If: Compare two values 

Only continue if there are issues for this flavor so we don't spam our clients with blank emails... 

more than 0 issues for this flavor.PNG

 

Then: Send email 

I would like to pull the value, the email address, from the lookup table. Though I am not sure if this is possible. 

send email.PNG

As a kicker, I'd also like to send a notification to myself and our deployments group so they are aware that clients have been notified. 

also email me.PNG

1 answer

1 accepted

0 votes
Answer accepted
Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 7, 2023

Hi @John Maner -

I don't think there is a .keys function for Lookup Tables. That would be pretty sweet.

Instead, I'm thinking you'll have to make a smart value variable with your keys (flavor-1,flavor-2...), and then use .split(",") to iterate through them.

Ah yeah, this seemed to work:

Screenshot 2023-09-07 at 9.41.59 PM.png

NOW, before you kill yourself trying to create 200 entries in the lookup table by hand (and then also creating that {{keys}} variable manually), I would implore you to take a look at my olde article, Hacking/Parsing Automation Rules with JSON for Fun and Profit.

It's been a while for me, so I looked at the rule I just created, and thankfully, a Lookup Table should be pretty easy to programmatically generate, the key pieces of it being this:

          "type": "jira.create.mapping-variable",
          "value": {
            "name": {
              "type": "FREE",
              "value": "apiFlavorEmails"
            },
            "mappings": [
              {
                "key": "flavor-1",
                "value": "flavor-1-deployments@email.com"
              },
              {
                "key": "flavor-2",
                "value": "flavor-2-deployments@email.com"
              }
            ]
          },

And the {{keys}} smart value variable looks like this:

          "type": "jira.create.variable",
          "value": {
            "id": "_customsmartvalue_id_1694147937774",
            "name": {
              "type": "FREE",
              "value": "keys"
            },
            "type": "SMART",
            "query": {
              "type": "SMART",
              "value": "flavor-1,flavor-2"
            },

So yeah, if I were you, I'd tweak your rule to have the first couple of flavors, then Export that puppy, use the scripting/IDE/spreadsheet of your choice to generate the other mappings and list of keys, hack that into the JSON file, and Import it back in.

Whoo though, 200 different types of APIs? That doesn't sound like much fun to do manually. So yeah, you could probably do the same exercise with Web Requests, etc.

But as always, start small. Test frequently. And have fun!

John Maner September 8, 2023

Ah, split is super clever, thank you! 

 

Also, we don't quite have 200... that's just the most which is supported by the lookup table feature ;) 

Appreciate the help! 

Like Darryl Lee likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events