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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Is there a way to concatenate or nest smart values?

I'm using Automation for Jira to automatically create a comment if the Approving Role for the current sub-task is "name of the role" but the value of the "name of the role" field within the parent of the sub-task does not equal the initiator of the workflow transition.

Instead of having to add if/else statements for every possible value {{issue.parent.name of the role.name}}, where "name of the role" is both the value of the sub-task's "Approving Role" field and the name of the custom field in the parent from which to grab a username for comparison to the initiator name, it would be great if the following were supported:

Condition:

{{initiator.name}}

does not equal

{{issue.parent.{{issue.Approving Role}}.name}}

5 answers

1 accepted

3 votes
Answer accepted
John McKiernan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 11, 2020

Thanks @John Funk 

@Michael Spoonauer - unfortunately other John is correct here. It isn't supported at the moment though we are tracking it here: https://codebarrel.atlassian.net/browse/AUT-1063

Makes a lot of sense. I have added a reminder at the end of the issue to post an update here once shipped.

Cheers,

John

Thanks for capturing this and for letting me know where to track it.

That would provide tremendous flexibility to the plugin, and get rid of a lot of if/else clauses.

Thanks again,
Mike

Nested if/else blocks feel different than being able to nest smart values.  But maybe I'm just missing it.  Also, can you allow members of the Atlassian community to watch codebarrel issues?

Thanks,
Mike

John McKiernan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 12, 2020

Hey Mike, 

Unfortunately there is no way of watching those issues for the moment. We are still trying to figure out the best way of bringing this over to the Atlassian systems. 

It might be worth putting through a support ticket with your request in case I am missing something. (I am on the marketing team rather than an engineer so they would have more experience around this). 

Cheers,

John 

Please refer to my answer here https://community.atlassian.com/t5/Jira-Software-questions/Is-it-possible-to-use-nested-Smart-Values/qaq-p/1423642#U2383398 where I am sharing the solution for nesting. 

Basically, you have to make a variable and then put it in the smart value.

  1. Create a variable varTemp to hold the value "templateIssue.CD"
  2. Then use the variable like this:
    {{now.plusBusinessDays(varTemp.asNumber).jiraDate}}

Note that you don't need the braces inside the brackets.

Hi - I found that nested variables appear to work for numeric variables:

Projected growth is off by {{issue.Projected growth.minus(issue.Actual growth).abs}}

https://support.atlassian.com/jira-software-cloud/docs/smart-values-math-expressions/

I wonder if this could work for regular fields. Maybe if I put it in a function?

I wonder if the reason putting another variable inside parentheses doesn't work for @Morten Stensgaard 's issue is because it's a Date field, as opposed to Numeric.

It would be really awesome if this existing mechanism was extended to work for other field types.

Like John Funk likes this

There is another problem regarding to the original question, trying to use it on a property access:

({{issue.parent.{{issue.Approving Role}}.name}})

Rather than method call:

.minus(issue.Actual growth)

We will need either a way to force inline evaluation, or a getter method equivalent to direct property access...

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 30, 2020

Right, I realized later that it's not exactly the same case as the method calls.

Inline evaluation is exactly right.

Because even if we weren't using a property, but say we just set a Variable to be a JSON object, like so:

Set Variable {{alpha-approvers}}:
{
"A" : "abelincoln",
"B" : "barrywhite",
"C" : "captaincrunch",
...
"D" : "zoesaldana"
}

The problem remains that there's no way to reference that value, because this won't work:

Edit Issue, set Approvers:

{{alpha-approvers.{{issue.field1.value}} }}

Darryl Lee
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Dec 07, 2020

Well, I finally got a request filed for this:

Possibility to nest smart values in Automation: 

https://codebarrel.atlassian.net/browse/AUT-2086

Bump - I have somewhat a similar usecase

 

I want to offset/postpone the Due Date by a numeric value from custom field in a automated rule/transition - Basically by replacing Due date with a current date+offset

 

But I cannot do so with:

{{now.plusDays({{issue.customfield_20530}})}}

 

I can only do static

{{now.plusDays(7)}}

 

I want the user to be able to have the input options for the offset

 

Right now I see no other solution than Scriptrunner/Groovy for something quite simple

 

Suggestions are welcomed

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 16, 2020

Hi Morten - Welcome to the Atlassian Community!

Just a note up front - it is always better to create a new question than to post to an existing question. That way more people will see it. 

When you say: 

But I cannot do so with:

{{now.plusDays({{issue.customfield_20530}})}}

I think you have too many brackets. Try this:

{{now.plusDays(issue.customfield_20530)}}

Thx - Will do next time.

{{now.plusDays(issue.customfield_20530)}} does not work in Update field on Due Date - It just blanks the Due Date field - Have tested with static values ex. 30 as input in the smart value func - This works(So my automation works)

 

Would be nice to have dynamic input from another field on the issue.

John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Oct 19, 2020

Can you post a screenshot of your actual rule with the code showing? 

Did you find a solution for this problem or is it just not possible yet? 

I have a similar issue.

0 votes
John Funk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 11, 2020

Hi Michael - I am pretty sure the answer is No. But it might be something on their Feature Roadmap.

@John McKiernan  - any thoughts?

Suggest an answer

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

Atlassian Community Events