Forums

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

Jira automation: custom field (date) + custom field (number of years) = custom field (date)

Lenka Burianova February 24, 2022

Hi everyone, 

can you help me with this one please?

I have a custom field Asset - start date, custom field Depreciation period which shows number of years of depreciation and then I have a custom field Asset - end date planned where I need the result of Asset - start date plus number of years in field Depreciation period

Is that possible?

Many thanks!

Lenka

1 answer

1 accepted

1 vote
Answer accepted
Stefan Salzl
Community Champion
February 24, 2022

Hi @Lenka Burianova 

I guess your choice would be

{{[date].plus[Unit]([number])}}

 

  • action: edit issue, field end date planned
  • update field with calculation of the smart value of your start date and add the smart value (number) of years 

 

See the documentation:

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

 

Please let me know if there are any further questions.

Best
Stefan

Lenka Burianova February 25, 2022

Hi Stefan, 

thanks for your answer.

I am currently using this formula: {{issue.Asset - start date.plusYears(4)}}

But this is applicable only for the task where the Depreciation period is 4. But it can be a different number for every task. That is why I am looking for a solution that will add the value in the field Depreciation period to the field Asset - start date.

Something like this (I know it is not correct):

{{issue.Asset - start date}} + {{issue.Depreciation period}} 

Thanks!

Stefan Salzl
Community Champion
February 25, 2022

You could also use the value of your "Deprication period" use as the number in the brackets. Try following:

{{issue.Asset - start date.plusYears(issue.Deprication period)}}
Stefan Salzl
Community Champion
February 25, 2022

I just tested the following automation rule in my system. 

  • field "Real start" is a custom field of type date picker
  • field "Years of usage" is custom field of type number
  • field "Expected End Date" - custom field of type date picker

I just filled in Real start and years of usage --> Expected End Date was calculated and filled in by the automation rule (--> see screenshot)

image.png

 

Hope this helps.

Best
Stefan

Lenka Burianova February 25, 2022

Thank you very much, Stefan!

I tried so many variations of this formula but was not able to find the right one. This finally works! :)

I just need to apply it also on changes in field Depreciation period and it is done.

Thanks again!

Lenka

Like Stefan Salzl likes this
Stefan Salzl
Community Champion
February 25, 2022

AWESOME!!! You are welcome.

Good to hear it works :)

 

Best
Stefan

Amit Shaw August 17, 2023

Hi Stefan, 

I also need the same thing but for only business days. 

Like I have custom field name Start Date (Date) and Duration(Number). 

I want to get the value in Due date = Start date + Duration 

But only for business days in due date custom field

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.
August 17, 2023

Hi @Amit Shaw 

Please try using the toBusinessDay function for that: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-date-and-time/

Kind regards,
Bill

Like Stefan Salzl likes this
Abdur Rehman January 23, 2025

Hi Stefan,

I am trying 

{{object.Last Periodic Review Date.plusYears(object.Review Frequency).format("MM/dd/yyyy")}}

but its returning null. I have checked that Review Frequency is Int type.

Any suggestions?

 

Stefan Salzl
Community Champion
January 23, 2025

Hi @Abdur Rehman 

This is an old solved post. And as it uses „object“ in the smart value I assume it‘s Jira Service Management.

Please consider opening a new thread describing your whole use case as well as providing screenshots of your rule.

Please also put some log actions in your rule and check all the entities one by one if the work on there own (for testing/denugging reasons).

Don‘t hesitate to tag me in this new post. 

Thanks in advance.

Best
Stefan

Suggest an answer

Log in or Sign up to answer