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.

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