Forums

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

Generating a projected date

john.monteith
Contributor
April 17, 2025

I have a custom field "Projected Completion Date" and I am trying to use a smart value to generate this date from the following inputs: 

  • Start Date (Audit log shows this value is a proper date value "2025-04-17)"
  • Total Hours Needed
  • Weekly Hours Available

I have created a variable (AdditionalDays) that calculates the number of days needed based on Total Hours Needed/ Weekly Hours Available * 7 - this give me the number of additional days needed. Audit log shows this value is correctly generated.

I am then trying to add this value to the Start date to give me the Projected Completion Date.

I have tried various iterations using the .plusDays method but I get an error of "Unable to render smart values when executing this rule:" An example of one of my attempts: {{issue.fields.Date Started.jiraDate.plusDays({{AdditionalDays}})}}

Does anyone know the correct syntax to get this rule to work.

I can provide screen shots if needed but the situation is pretty straight forward in its description.

 

2 answers

1 accepted

2 votes
Answer accepted
Trudy Claspill
Community Champion
April 17, 2025

Hello @john.monteith 

It would be helpful if you provided us with screen images that shows your entire rule. Sometimes these types of errors are related to the context of the step.

Without that info I have the following suggestions.

Remove the curly braces inside the parentheses and around the name AdditionalDays.

Change the order of the functions from .jiraDate.plusDays() to .plusDays().jiraDate

john.monteith
Contributor
April 18, 2025

Hi Trudy,

I was hoping it was just a simple syntax error (which I did apparently make) and someone would just point out the error of my ways. : )

I have played around with your suggestions and Piyush's. Here is where the rule stands now, I used variables and log entries to determine where the issue is.

Projected date Jira.PNG

 

  • The Additional Days variable returns the correct value
  • The Start Date variable returns the correct value - I used a future date to check this
  • The New Date variable which I have tried constructing with the various suggestions listed below does not return anything:
    • Using field name  issue.fields.Date Started
    • Using variable name StartDate
    • Moving jiraDate before and after plusDays().

           

Date audit log.PNG

 

 

Trudy Claspill
Community Champion
April 18, 2025

Thank you for that additional information.

When you create a variable, the information is stored as a string. So if you have a variable that is showing a date and try to use a date function with it, that won't work. You would be trying to apply a date function to a string; i.e.

{{StartDate.plusDays(AdditionalDays)}} 

is interpreted as

<string value> plusDays <string value>

You have to cast the variable string values as the appropriate data type.

StartDate.toDate("<formatting of the StartDate value>")

i.e. if StartDate is 2025-04-18 then to cast that as an actual date to which you can apply other date manipulation functions:

StartDate.toDate("yyyy-MM-dd")

Then cast AdditionalDays as a number:

AdditionalDays.asNumber

And optionally apply a date formatting command at the end:

{{StartDate.toDate("yyyy-MM-dd").plusDays(AdditionalDays.asNumber).jiraDate}}

If your starting date is a reference to a field that is already a Date or Date/Time field, you don't need to use the toDate function nor the final date formatting function; i.e.

 

{{issue.Date Started.plusDays(AdditionalDays.asNumber)}}

Like Bill Sheboy likes this
john.monteith
Contributor
April 18, 2025

Hi @Trudy Claspill 

Thank you for the clarification. Because the two fields used to generate the Additional Days value were both number fields, I did not even think about Jira referencing that value as a string. Everything works great now. Thanks!!

Like Trudy Claspill likes this
0 votes
Piyush Annadate _ACE PUNE Community Leader_
Community Champion
April 17, 2025

Hi @john.monteith ,
I suspect, you should use  as below

{{issue.fields.Date Started.plusDays(AdditionalDays)}}


Don’t wrap AdditionalDays in {{ }}—just reference the smart value name directly in the function.

Variables:

  • StartDate = {{issue.fields.Date Started}}

  • AdditionalDays = {{#=}}{{TotalHours}} / {{WeeklyHours}} * 7{{/}}

Then your final expression for Projected Completion Date should be:

{{issue.fields.Date Started.plusDays(AdditionalDays)}}

Or, if you used Create variable for AdditionalDays, just refer to it:

{{StartDate.plusDays(AdditionalDays)}}



john.monteith
Contributor
April 18, 2025

Hi @Piyush Annadate _ACE PUNE Community Leader_ ,

Thanks for your suggestions, I also got a response from @Trudy Claspill

Please see my reply to Trudy's message.

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 18, 2025

Hi @Piyush Annadate _ACE PUNE Community Leader_ 

When posting bot / AI-generated content, ensure you disclose the source in your post text.  For more information, please carefully review the community guidelines:

https://community.atlassian.com/forums/custom/page/page-id/rules-of-engagement

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events