Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Variable usage in smart values

青山 明
Contributor
April 11, 2024

In the smart value of {{webResponse.body.results.get(0).id}}, can the 0 part of get(0) be expressed as a variable?

1 answer

1 vote
Vijay Dadi
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.
May 21, 2024

Hello @青山 明 ,

Add a create variable step variable in your automation and assign the value {{webResponse.body.results.get(0).id}} to it.

Then you can access variable as {{Variable_Name}}.

Hope this helps !

青山 明
Contributor
May 21, 2024

Do you have any specific examples or samples?

Vijay Dadi
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.
May 21, 2024

Here is one such example, which i used for lookup objects.

1. I did lookup objects.

2. Then I created variable as ApprovalGroup.

3. Then I can use it as {{ApprovalGroup}} in my automation.

var.pngvar1.png

Like Sanjay G likes this
青山 明
Contributor
May 21, 2024

It seems a little different. What I want to know is whether indicators can be defined as variables in smart values.

青山 明
Contributor
May 21, 2024

The smart value of {{webResponse.body.results.get(0).id}} can be written as {{webResponse.body.results.get({{variable}}).id}}.

Like Vijay Dadi likes this
Vijay Dadi
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.
May 21, 2024

yes, very much. It works !

青山 明
Contributor
May 21, 2024

Can I write it like {{webResponse.body.results.get({{variable}}).id}}?

Vijay Dadi
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.
May 21, 2024

Yes that will work.

青山 明
Contributor
May 21, 2024

Is useless. I get an error like below.

Failed to get value for webResponse.body.results.get({{variable: {{webResponse.body.results.get({{variable}}).id}}

Vijay Dadi
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.
May 21, 2024

put log action and see what value you are getting in variable.

 

Add log action step and print {{variable}} and verify what value variable is holding.

青山 明
Contributor
May 21, 2024

An error occurs when writing {{webResponse.body.results.get({{variable}}).id}}. Do you understand the question?

青山 明
Contributor
May 21, 2024

Just to double check, isn't it possible to write {{webResponse.body.results.get({{variable}}).id}}?

Suggest an answer

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

Atlassian Community Events