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.
×Hi,
We want to add Post Function To Transition applicable that we can report for the number of days between the creation date and the closed date.
Detail: Calculation (Current Day Time - )
Refer to target spot:
I want to know how to configure by "ScriptRunner for JIRA" installed.
Best Regards,
Pabayos Alaine
Place a code for scriptRunner to calculate requared value. Somethink like this:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue import com.atlassian.jira.issue.fields.CustomField import java.sql.Timestamp return (int) ( System.currentTimeMillis() - getMillsForCstFd("custom field name 1", issue))/(1000*60*60*24) public long getMillsForCstFd(String _customFiledname, Issue _issue){ CustomField customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName(_customFiledname); if(customField == null) return 0 Timestamp cstFldDate = (Timestamp) _issue.getCustomFieldValue(customField); return (cstFldDate == null) ? 0 : cstFldDate.getTime(); }
Do reindexation to set values.
In your case "Accepted Date Time" is a custom field.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In this case, a scripted field is a much nicer answer than a post-function plus a custom field. I just wanted to add that you probably want to set the output to a "number" type, so that you can search it
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 executed according to instruction.
>1.Create a scripted field
Issus > Custom Fields > Add Custom Field > Select a Field Type "Scripted Field"
>2.Place a code for scriptRunner to calculate requared value. Somethink like this:
Issus > Custom Fields > Scripted Field > Configurations > Edit Configuration
>3.Do reindexation to set values.
System > Indexing > (Lock JIRA and rebuild index)Re-Index
But there was nothing changed.
What is the configure of shortage ?
Best Regards,
Pabayos Alaine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you added the field to the issue view screen?
When you added the script, did you use the "preview" box at the bottom of the script definition page to test what the output would be? What did that do?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry.
Your instruction is bellow:
Issus > Custom Fields > Scripted Field > Configurations > Edit Configuration
is it correct?
In the following another way...
Add-On > Script Console> Script
Which is correct?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, no-one has mentioned the script console because you're working with a scripted field, so the script console is the wrong place to look.
Go to the scripted field, put in the script you want and select an issue to test it with. What does the preview tell you?
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.