-
Bug
-
Resolution: Unresolved
-
Low
-
None
-
Severity 3 - Minor
Issue Summary
When using the smart value [date].plus[Unit]([number]) automation to sum days and update a date, the automation does not recognize variables.
Steps to Reproduce
Use a variable to define the number of days that should be added using plusDays or plusWeeks.
Example:
- Create an issue and fill Start date with Oct, 2nd 2023 and the number custom field number 1 with 1
- Create an automation rule with any trigger - for example, we can use a scheduled trigger and in the JQL, look for the issue created on the step above (key = KEY-1)
- Create a variable a and define its value as 1
- Add a log action with the following code:
With a number: {{issue."Start Date".plusDays(1)}} // With a variable: {{issue."Start Date".plusDays(a)}} // Using an issue field: {{issue."Start Date".plusDays(issue."number 1")}}
- Add a log action with the following code:
plusWeeks - With a number: {{issue."Start Date".plusWeeks(1)}} // With a variable: {{issue."Start Date".plusWeeks(a)}} // Using an issue field: {{issue."Start Date".plusWeeks(issue."number 1")}}
- Run the rule and check the audit log
Expected Results
plusDays or plusWeeks uses the variable to know how many days it should sum.
Given that the start date is Oct, 2nd 2023, the results of the example above for the first audit log action should be (please note the part "With a variable"):
With a number: 2023-10-03 // With a variable: 2023-10-03 // Using an issue field: 2023-10-03
The second audit log action should be (please note the part "With a variable"):
plusWeeks - With a number: 2023-10-09 // With a variable: 2023-10-09 // Using an issue field: 2023-10-09
Actual Results
plusDays or plusWeeks ignores the date and the whole smart value returns empty.
Given that the start date is Oct, 2nd 2023, the results of the example above are (please note the part "With a variable"):
With a number: 2023-10-03 // With a variable: // Using an issue field: 2023-10-03
The second audit log action should be (please note the part "With a variable"):
plusWeeks - With a number: 2023-10-09 // With a variable: // Using an issue field: 2023-10-09
Workaround
Instead of using a variable, use either a number directly or use the issue smart values, when possible.
Additional observation
A similar issue is observed with numerical operations where using variables with functions such as plus() is not recognized.
Workaround:
Use math expressions such as:
{{#=}}{{custom_num_variable_1}} + {{custom_num_variable_2}}{{/}}