Hello there,
I am getting an issue on a calculated field.
The value return on my view screen is $value.longValue().
When i trace my value in log field, i get the rigth format (a number)
my calculated field get the number of day between the created date of an issue and the date of today.
I am missing something but i dont get it
here is the code i used:
// Bibliothéque
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.Issue;
import java.util.Date.*;
import org.apache.log4j.Category
//definition of logs
Category log = Category.getInstance("com.onresolve.jira.groovy")
log.setLevel(org.apache.log4j.Level.DEBUG)
log.debug("Dans mon script FIeld")
// je recupére mon context.
def issueManager = ComponentAccessor.getIssueManager()
def customFieldManager = ComponentAccessor.getCustomFieldManager()
// je récupére le champs Date Dépose Ticket et sa valeur
def cfdatecreationvalue = issue.getCreated() as Date
log.debug("cfdatecreationvalue: " + cfdatecreationvalue)
//je crée la date du jour
Date today = new Date()
def compteur = 0
log.debug("compteur: " + compteur)
log.debug("today: " + today)
// ma formule de calcule
if(cfdatecreationvalue == null || cfdatecreationvalue == 0)
{
log.debug("IF 1")
compteur = 0
}
else if (today != cfdatecreationvalue)
{
log.debug("IF 2")
compteur = today - cfdatecreationvalue
}
log.debug("final compteur: " + compteur)
return compteur
If you find out where i am doing something wrong please let me know :)
regards,
Olivier
Hello,
What is exactly the error? The value has a different format on the screen?
Hello,
i get $value.longValue(). on the screen and 1 in the log.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Just return $value. Without the longValue() part.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
heu i am not sure you get it
i return my value like this:
compteur = today - cfdatecreationvalue
Return compteur
and i get
$value.longValue() on IHM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What is the template for your scripted field?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
i have try both template number field and text filed multi line.
No change, my screen view always $value.longValue() is displayed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
i found out my probleme.
Thx once again for the support :)
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,
i have to switch the template of the scripted field from Number Field to Text Field (multi-line).
Olivier
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.