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:
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.
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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)}}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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.