Automation - Lookup Table appears inaccessible in loop

Iain Powrie December 10, 2024

Having a bit of a puzzling issue here...

Scenario:

I'm trying to create an automation on JSM. I want a comment to be added to the request based on whats been selected in a multi select custom field.

Dependant on what has been selected it will link a sharepoint link corresponding to the option(s) selected.

Workflow:

When: Issue Created
IF: Product Portfolio is not empty
Then: Create lookup table {{sharePointLinks}}
And: Add comment to issue

Lookup table:
---
Option 1 : CatLink
Option 2 : DogLink
Option 3 : LiopleurodonLink
Comment template:
---

Documentation links:

{{#issue.fields.customfield_XXXXX}} - Debug 1 {{value}}: {{sharePointLinks.get(value)}}
- Debug 2 {{value}}: {{sharePointLinks.get(string(value))}}
- Debug 3 {{value}}: {{sharePointLinks.get(value.trim())}}
- Debug 4 Test: {{sharePointLinks.get("Option 3")}} {{/issue.fields.customfield_XXXXX}}

Test Lookup: {{sharePointLinks.get("Option 3")}}

Result:

With Option 1 and 3 selected, I get the following output:

 

Documentation links:

- Debug 1 Option 1:
- Debug 2 Option 1:
- Debug 3 Option 1:
- Debug 4 Test:
- Debug 1 Option 3:
- Debug 2 Option 3:
- Debug 3 Option 3:
- Debug 4 Test:

Test Lookup: LiopleurodonLink

Expected Result:

 

Documentation links:

- Debug 1 Option 1: CatLink
- Debug 2 Option 1: CatLink
- Debug 3 Option 1: CatLink
- Debug 4 Test: LiopleurodonLink
- Debug 1 Option 3: LiopleurodonLink
- Debug 2 Option 3: LiopleurodonLink
- Debug 3 Option 3: LiopleurodonLink
- Debug 4 Test: LiopleurodonLink

Test Lookup: LiopleurodonLink

Theory:

For some unfortunate reason it looks like the data stored in the lookup table is not able to be called for, from within the context of the smart value loop, Is there anyone out there that has tried similar and got it working with lookup tables so you don't end up having to maintain a smart value if soup?

1 answer

1 accepted

1 vote
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.
December 10, 2024

Hi @Iain Powrie -- Welcome to the Atlassian Community!

This is a long-standing limitation of automation rule iterators: only information at the iterator scope, and lower, is visible inside.  

Here is an open suggestion to change that behavior: https://jira.atlassian.com/browse/AUTO-490

 

For this scenario, the possible workarounds are:

  • skip the lookup table and use conditional logic to perform the substitutions
  • skip the lookup table and use chained, replace() functions
  • (the messy one) permutations
    • when there are only a few values in the lookup table, substitute joined row-keys that will include all possible permutations of the joined values: A, B, C, AB, AC, ABC.  Same thing for the table row-values.
    • use the joined values from the multiple-selection field as the key to lookup in the table
    • as needed, split apart the row-values found from the get()
  • (the messier one) write an external service to perform the substitutions, passing the field and table entries to it with the Send Web Request action

 

Kind regards,
Bill

Iain Powrie December 16, 2024

Hi @Bill Sheboy , Thanks for the warm welcome!

Darn, had a feeling that'd be the case. That's a shame, as LU table would have been great for other users to 'easily' amend the responses without worrying about syntax. 

Not to worry though, I'll register my interest on that suggestion, and follow one of your workarounds. 

Thank you kindly for your insight! 
-Iain

Like Bill Sheboy likes this

Suggest an answer

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

Atlassian Community Events