Hi, I am trying to set due dates based on the Component that is set on the Story (Small, Medium, Large). Note that I copy the Components to the sub-tasks in an attempt to simplify the logic of looking up the Components.
I created an if else-if branch to manage these three conditions, and in each I set a variable to hold the date.
Right after the variable is set, I have a For Parent branch to create sub-tasks and assign due dates...but they are turning up blank.
So I added a test audit log entry to see if the variable existed even just after the if else-if branch ended and it doesn't. It's already null.
I can see in the rule audit log that the condition passes successfully so why is my variable null?
thanks
Is the log action within the if/else block or outside? The screenshots indicate that it is outside of the if/else block and that would explain why the variable is null. A smart value that is created with a if/else block is only available within that block and cannot be accessed outside of it.
Outside. The article where they launched this feature says exactly this:
This article is for the power users of Jira automation to show you how to use our new 'Create variable' action.
This new action allows you to define your own smart value, which can be used in other actions and conditions in the same rule.
So to me it makes no sense that it is confined to only the if else block. Maybe they'll broaden in the future.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It depends on where you create the variable. If you look in the article they are creating the variable first before using it in the branch. If the variable is created with the branch, you will not be able to access it outside of that branch, that's the difference.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I agree with Derek here. I have a similar automation where I set a variable, and need to use outside the IF block I created it in.
I also found this: https://jira.atlassian.com/browse/AUTO-154
Looks like it's an active feature request.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Mikael Sandberg yes you're right -- but the value of the variable is based on which Component is tagged so I have no choice but to set it in an if/else block.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I haven't tried this but can you create it outside the if/else block and then set in inside?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Kelly Arrey yes, if you create the variable outside of the if/else block it becomes a global variable and can then be used inside the if/else block. Have a look at the article above that Derek linked to.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Derek F You can set the variable to null outside of the if/else block and then use it within to set it to the right value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I reread that a few times so...I use "create a variable" to create it before the loop and then "create a variable" again to set it to the actual value I want and use it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Correct, you will have to use the create a variable multiple times, but as long as you use the same name it will just update the value for the variable.
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.