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}}
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
{{now.plusBusinessDays(varTemp.asNumber).jiraDate}}
Note that you don't need the braces inside the brackets.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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}} }}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, I finally got a request filed for this:
Possibility to nest smart values in Automation:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you post a screenshot of your actual rule with the code showing?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you find a solution for this problem or is it just not possible yet?
I have a similar issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Michael - I am pretty sure the answer is No. But it might be something on their Feature Roadmap.
@John McKiernan - any thoughts?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.