I can't seem to find a way to use a variable inside a smart value. For example:
{{ now.withMinute( {{originalMinutes}} ) }}
...where {{originalMinutes}} is declared earlier in the automation as a math function:
{{#=}} {{issue.customfield_10030.toStartOfDay.diff(issue.customfield_10030).minutes}} - ({{originalHours}} * 60) {{/}}
I'm trying to update a datetime value to a new date, while retaining the time. So far I have all the pieces, but when I go to put them together, they require nesting of some sort, which appears unsupported.
One way around this would be if I could pull the hour, minute, and second attributes directly from the original datetime, but that also appears unsupported (or at least poorly documented).
Atlassian shared with me the solution.
So it is possible to do nesting with variables. Here is how:
Then use the variable like this:
{{now.withMinute(varTemp)}}
Note that you don't need the braces inside the brackets.
Below is my automation which might give you a better understanding. My case: add business days to get Due date to create issues every month with new Due dates.
lovly! Thanks for sharing. This also works in complex regex like:
{{lookupIssues.summary.match("^(?:CR|RW)HighestCycleNumber-(\\d{3})").asNumber.max}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Knust_ Johannes how do you get this to work with regex? Can you provide an example?
I tried creating a variable with the name regex and the value of:
"entryId=[^&]+&", "entryId={{userInputs.id}}&"
and the try to call it later like so:
{{webResponse.body.body.atlas_doc_format.value.replaceAll(regex).jsonEncode}}
But it just returns empty. I verified it works if I hard code the regex into the second call.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
it seems jira changed something; nevertheless here is my scenario and solution to it.
my requirement was a jira issue with title t should be able to automate with a change request or reword and marked in a new ticket t+1 with CR02-000 (first digits) or rework RW01-001 (last three digits) increase +1
therefore from t to t+1 its easy you know its the second ticket so either its CR +1 = 2 or its RW therefore 01 stays and the sum of 000 + 1 = 001.
The magic starts with reading from ticket t how many linked tickets t+x exists; read the last and calculate based on the logic + 1.
I found out that I can do things like this:
(easy)
var: HighestCycleNumber = {{lookupIssues.summary.match("^(?:CR|RW)(\\d+)-").asNumber.max}}
(advanced - a two step process!)
var: TempRWCycleNumber = {{lookupIssues.summary.match("^(?:CR|RW)(\\d{2}-\\d{3})").replace("-", "").asNumber.max}}
var: RWCycleNumber = {{TempRWCycleNumber.right(3)}}
and than some if else explosion (yes I used pen and paper to get my scenarios)
When creating than the new ticket the title is in this first example:
RW0{{HighestCycleNumber}}-00{{RWCycleNumber.asNumber.plus(1)}} : {{triggerIssue.summary}}
Why so complex?
Easy, when using regex Jira does not allow to keep leading 0's...
Therefore I had to identify the amount of leading 0's and made it work.
hope that helps; it took me a while and AI could not figure that out either :P
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Don't you wish we could upvote Automation feature requests:
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.
Hey Sean - Welcome to the Atlassian Community!
Take a look at this previous post:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.