Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×Hello!
I'm using JIRA Software 7.1.0
I'm trying to use formula but it doesn't works....
<!-- @@Formula:
if (issue.get("resolutiondate") == null)
return ((new Date()).getTime() - issue.get("created").getTime()) / 1000 / 3600 /24 + "days";
else
return (issue.get("resolutiondate").getTime() - issue.get("created").getTime()) / 1000 / 3600 /24 + "days";
-->
What should I do...Please help me...
Please describe the input and output in english: I could much more easily write a new formula than try to guess what your end-game is.
Thank you for your reply.
In the Servicedesk project I would like to calculate how many days it took to resolve since the ticket was issued.
I want to display "XX days".
1. If there is a resolution date (status is closed), "resolution date - creation date"
2. If there is no resolution date (status is not closed), "today - creation date"
How can I do it?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay, I think your script is actually just fine. The approach seemed fine and the syntax was correct.
However, the script has this error when running:
CalculatedTextField: error evaluating formula of field "Age (Calculated)" of issue JIRA-833: Sourced file: inline evaluation of: `` if (issue.get("resolutiondate") == null) return ?(new Date()).getTime() - iss . . . '' Token Parsing Error: Lexical error at line 3, column 8. Encountered: "\uff08" (65288), after : "": <at unknown location> Navigate to the following URL to edit the formula: https://jira-sandbox.example.corp/secure/admin/EditCustomField!default.jspa?id=19800
Within your script, there is an invalid character. This appears to be one of your parenthesis: "(" vs "(".
Thus, updating your script to fix that character works just fine. I also added a space to the " days" string.
Source
<!-- @@Formula: if (issue.get("resolutiondate") == null) return ((new Date()).getTime() - issue.get("created").getTime()) / 1000 / 3600 /24 + " days"; else return (issue.get("resolutiondate").getTime() - issue.get("created").getTime()) / 1000 / 3600 /24 + " days"; -->
Example
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You may want to consider implementing this as a Calculated Number field and using the @@Format option to append the " days" string. That would give you natural sorting.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No problem. It didn't present any error in the UI: Everytime I refreshed the Issue View though it printed that error in the logs. It's very useful to check the logs when making new script fields. :) Good luck! Happy to help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi MISUMI-san,
I assume you are a Japanese speaker (I am sorry if I am wrong!) and if you feel comfortable asking questions or/and getting answers in Japanese, you can add a tag "Japanese" so that it will be shared with other Japanese users. (Also I am willing to provide translation as a community member if needed!) Hope you find this useful!
Regards,
Naho Inuyama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You are very welcome! We also have offline user groups in Tokyo, Osaka,Nagoya and Chugoku Area. (and most likely I will be at each event.) It's a great way to share and learn how other peple are using Atlassian products, please join us anytime if you are interested!
お待ちしております。
Naho Inuyama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.