Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to read field value from dynamic field name into a SmartValue in Jira automation

MARCO EBERHARD
September 2, 2024

I have a dynamic Field name in a Smart Value {{VarField}}

It is no problem to set a value using  "Edit issue fields" Advanced like this:

{

  "fields": {
         {{VarField}}: {{VarValue}}
         }
}

Until now, I struggled with doing the opposite:  Reading the field value from {{VarField}} into a SmartValue {{VarValue}}.

How can I do this?

1 answer

0 votes
Alex Koxaras -Relational-
Community Champion
September 2, 2024

Hi @MARCO EBERHARD 

What do you mean by "dynamic field"? Is it a custom field which you have created inside Jira? If yes then you could get it using the smart values https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/#issue[.custom%20field]:~:text=the%20issue%27s%20reporter.-,%7B%7Bissue.%5BCustom%20Field%5D%7D%7D,-Similar%20to%C2%A0

If not, kindly explain further.

MARCO EBERHARD
September 2, 2024

Hi @Alex Koxaras -Relational- 

I have several custom fields following a standardized field name scheme.

In the automation, the field name I want to read out is calculated. So {{VarField}} might have one of the following values:
- Field_01
- Field_02
- Field_03
- ...

{{issuel.Field_01}} is working but {{issue.{{VarField}}}} does not work.

if needed, I could also work with customfield_xxxxxx instead of Field_yy

Thanks, Marco

Alex Koxaras -Relational-
Community Champion
September 2, 2024

How do you calculate the VarField? Using smart values inside the "create variable" component?

MARCO EBERHARD
September 3, 2024

@Alex Koxaras -Relational- 

I have created a lookup table containing around 20 entries with a key and the FieldName as value.

Key                   Value
Key_01              Field_1
Key_02              Field_2
...

Then I Branch for each {{Table.entries.key}}  --> into {{ActualKey}}

Then I get the field Name (Crate Variable) {{Table.get(ActualKey)}} --> into {{VarField}}

Now, I want to read the value of the field that's name is in {{VarField}} into {{VarActualValue}} --> here I struggle.

Then I want to do some calculation wit {{VarActualValue}} into {{VarValue}}

Then I Edit issue Field "Advanced"

{

  "fields": {
         {{VarField}}: {{VarValue}}
         }
}

To write back the new value is working perfectly.

Thanks.

Nathan Myers
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 10, 2026

I have encountered this problem which is causing an issue with establishing Jira automations for my needs.

This appears to be a bug with Jira automation smart values. I have created the steps below to replicate the issue, and the audit log displays the test steps and results:

  1. Trigger or branch on any test issue
  2. Create variable. Name: 'testKeyVar'. smart value: 'testKey'
  3. Set entity property. Entity type: 'Issue'. Property key: 'key_{{testKeyVar}}'. Property value: 'testValue'
  4. Log action: 'Expect result: testValue - Actual result: {{issue.properties.key_testKey}} - Comment: Works'
  5. Log action: 'Expect result: testValue - Actual result: {{issue.properties."key_testKey"}} - Comment: Works'
  6. Log action: 'Expect result: testValue - Actual result: {{issue.properties.key_{{testKeyVar}}}} - Comment: Returns }}'
  7. Log action: 'Expect result: testValue - Actual result: {{issue.properties."key_{{testKeyVar}}"}} - Comment: Causes error'
  8. Log action: 'Expect result: testValue - Actual result: {{issue.properties.get("key_{{testKeyVar}}")}} - Comment: Causes error'

 

When the above automation rule runs, the log result are shown for steps 4, 5, 6 and 7 (8 doesn't run because it halts on error at step 7):

4. Expect result: testValue - Actual result: testValue - Comment: Works

5. Expect result: testValue - Actual result: testValue - Comment: Works

6. Expect result: testValue - Actual result: }} - Comment: Returns }}

7. Unable to render smart values when executing this flow:
Failed to get value for issue.properties."key_{{testKeyVar: Expect result: testValue - Actual result: {{issue.properties."key_{{testKeyVar}}"}} - Comment: Causes error

 

Could this please be fixed?

 

Thank you.

Suggest an answer

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

Atlassian Community Events