Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Use smart values within smartvalues

Christof Hurst
Contributor
April 25, 2025

Hi, 

we are implementing scheduled tasks. For this we create asset objects with e.g. a startDate, a frequency with a duration.

An automation looks every day if there are tasks to create. 

My idea was to calculate a new date and compore it to {{now}}.

But in my tests i get no results.

Object:

  • Startdate: 01 May 2025
  • Frequency: per quarter
    • PlusTime: 3
{{object.Startdate.plusMonths(object.Frequenz.PlusTime)}}

or

{{object.Startdate.jiraDate.plusMonths(object.Frequenz.PlusTime)}}

But I can't get a result in my logs. This also if I create another variable with plusTime.

Where is my mistake? Is there another way which I do not see?

Edit:

I make it easier:

1. create a variable "plus" with value "3"

2. log {{object.Startdate}}: 2025-05-01T00:00:00.0+0000

3. log {{plus}}: 3

4. log {{object.Startdate.plusMonths(plus)}}: EMPTY

5. log: {{object.Startdate.plusMonths(3)}}: 2025-08-01T00:00:00.0+0000

BR Christof

2 answers

1 accepted

6 votes
Answer accepted
Christof Hurst
Contributor
April 25, 2025

@Raphael Lopes you were on the right way. What was your prompt?

It works with

{{object.Startdate.plusMonths(plus.asNumber)}}

 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 25, 2025

Hi @Christof Hurst 

Well done solving your own question!

For more information on using variables as numbers with the various rule function types, please see this article I wrote on the topic:

https://community.atlassian.com/forums/Automation-articles/Automation-concepts-Using-Created-Variables-as-Numbers/ba-p/2953116

Kind regards,
Bill

2 votes
Raphael Lopes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 25, 2025

Hi @Christof Hurst, and welcome to the Community!

You're definitely on the right track with the concept — using Assets objects with startDate and a repeat interval to trigger scheduled tasks via automation. But there are a few gotchas when working with date calculations and custom object references in Assets automations.

Let’s go step-by-step to understand what’s likely causing your issue.

 

Problem Breakdown
You mentioned this expression:

{{object.Startdate.plusMonths(object.Frequenz.PlusTime)}}

And that it returns no value in your logs. Here are potential causes:

 

Startdate must be a valid date (Date type in Assets)
Make sure that:

  • The Startdate attribute is truly of Date type in the Assets schema.
  • The value is set and not null.

 

Frequenz.PlusTime must be accessible as a number
If Frequenz is a referenced object, you cannot access PlusTime directly with . in smart values like object.Frequenz.PlusTime unless:

  • Frequenz is properly resolved in context (only some automation contexts allow this).
  • PlusTime is a number field and not empty.

In practice, Assets smart values don’t support full object traversal like this out of the box in Jira Automation.

 

How to Fix It (Recommended Pattern)
Here’s a working pattern I’ve seen used in similar setups:

Step 1: Use a variable for the duration
Let’s assume you want to calculate:

Startdate + 3 months

Do this:


{{object.Startdate.plusMonths(3)}}

This should return a proper date. Test this first to confirm that Startdate is parsed correctly.

 

Step 2: Try storing the PlusTime as a direct attribute (on the same object)
If you move PlusTime to be on the same object (not via a reference like Frequenz), then you can safely write:

{{object.Startdate.plusMonths(object.PlusTime)}}

This works because object.PlusTime is a direct number field — much more reliable in automation.

Step 3: Debugging the values
Add a Log action with the following lines to validate if you’re getting anything:


Startdate: {{object.Startdate.jiraDate}}
PlusTime: {{object.Frequenz.PlusTime}}
Combined: {{object.Startdate.plusMonths(3)}}

If any of these return blank, you know where the chain is breaking.

 

Bonus: Dynamic unit logic (optional)
If you're handling durations like "monthly", "quarterly", etc., you might consider:

  • Storing Frequency as a string field (e.g., "monthly", "quarterly")
  • Using conditional logic:
{{#if(equals(object.Frequency, "quarterly"))}}
{{object.Startdate.plusMonths(3)}}
{{/if}}

 

I really hope you.

Regards.

 

Christof Hurst
Contributor
April 25, 2025

Thx. 

Option 1 and 2 are no options.

Every value is debugged and contain the correct value. 

{{object.Frequenz.PlusTime}} = 3

I need to do this all dynamically and there must be solution.

Of course I asked AI too as your answer also seems to be generated.

Raphael Lopes
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 25, 2025

Hi Christof,

You're right — the issue is not with the values, but how Jira handles them in expressions like .plusMonths().

Even though {{object.Frequenz.PlusTime}} returns 3, Jira doesn’t treat it as a number inside plusMonths() unless you set it explicitly.

Maybe:
Use #set to coerce the value before using it:

{{#set(plus, object.Frequenz.PlusTime)}}
{{object.Startdate.plusMonths(plus)}}
{{/set}}


This makes Jira treat it as a number, and the date calculation will work.

Let me know if you need help comparing it to {{now}} after that!

 

Christof Hurst
Contributor
April 25, 2025

Thx, where is this documented? I didn't find anything in the docu.

I do not think "set" is a valid syntax. this returns also no value.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events