I am really new to automation.
We started using Teams instead of creating Service Accounts that can be assigned tickets.
I am creating automation to detect when the Teams field is changed to a specific Team field value then send an email to a Distribution list associated with the team.
My question is do I need to duplicate this automation for all 200 former Service Accounts or is there a way to check a number of conditions?
It sounds like you're looking for an If/Else condition to check things.
Ideally a case/switch statement like used in many programming languages would be ideal for that many different options, but its not supported in automation.
Question... are expecting there be 200 unique outcomes for every different former service account, or will there be 200 teams that need to be checked and only a handful of outcomes?
The below link will give you information on the available conditions. The only limitation is that you can only have 65 conditions per rule, so if there are 200 unique outcomes it will probably still require multiple rules, however, you can combine a number of them into the same rule .
https://support.atlassian.com/cloud-automation/docs/jira-automation-conditions/
https://support.atlassian.com/jira/kb/automation-rule-message-youve-reached-the-maximum-number-of-65-components-allowed-per-rule/
Without seeing an example of your rule and what would change for different teams / service accounts, it may be difficult for the community to offer suggestions. Would you please post an image of the example rule? Thanks!
Until we see that...
Although a rule can test multiple conditions, such as with an if / else block, that would not work with 200 tests due to rule length limits.
An alternative might be using a Lookup Table, which as a limit of up to 200 rows.
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.
@Ryan M creating multiple rules to handle 200 IF-ELSEs would be a nightmare. :-O
@Bill Sheboy 's suggestion of a Lookup Table is better, except manually entering 200 rows would also suck. Imagine having to use this interface 200 times, especially if you already have the data somewhere like Excel or something:
@Anne Gallant if you do go the Lookup Table route, then I would suggest creating and testing the rule with just one or two Teams/DLs.
If it works, it would be possible to programmatically generate the rest of the entries by Exporting the rule, inserting additional mappings, and then importing the rule back. The format for Lookup tables is fairly straightforward JSON:
{
"id": "719916442",
"component": "ACTION",
"parentId": null,
"conditionParentId": null,
"schemaVersion": 1,
"type": "jira.create.mapping-variable",
"value": {
"name": {
"type": "FREE",
"value": "TeamToDL"
},
"mappings": [
{
"key": "Accounting",
"value": "dl-accounting@darryl.com"
},
{
"key": "Engineering",
"value": "dl-engineering@darryl.com"
}
]
},
So assuming your data was in CSV format like:
key,value
Accounting,dl-accounting@darryl.com
Engineering,dl-engineering@darryl.com
Another Team,dl-anotherteam@darryl.com
You could run it through a site like https://csv.keyangxiang.com/ or https://www.convertcsv.com/csv-to-json.htm
Which would generate an array like so, that you could copy and paste to replace the existing mappings section:
[
{
"key": "Accounting",
"value": "dl-accounting@darryl.com"
},
{
"key": "Engineering",
"value": "dl-engineering@darryl.com"
},
{
"key": "Another Team",
"value": "dl-anotherteam@darryl.com"
}
]
This could save you a lot of typing.
If using random sites to convert your CSV to JSON is a concern there are Excel Macros and such: https://stackoverflow.com/questions/19187085/what-is-the-easiest-way-to-convert-an-excel-spreadsheet-with-tabular-data-to-jso
Atlassian doesn't endorse hand-editing their rules, but here's their docs on the import/export functionality:
And here's an article I wrote about "hacking" rules in their JSON format:
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.