I am trying to add sprint end date and start date custom fields. I though I could do that by:
1. Adding a groovy scripted field and update it from the database during workflow transition
2. Database values plugin
Any ideas?
I don't see a problem having a scripted field. Here's code that works for me.
Use the "date time range indexer", and the "date" template:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.issue.Issue def customFieldManager = ComponentAccessor.getCustomFieldManager() def sprintCf = customFieldManager.getCustomFieldObjectByName("Sprint") Issue issue = issue issue.getCustomFieldValue(sprintCf)?.startDate?.first()?.toDate()
Thanks Jamie, this is brilliant.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay this works now for JIRA 7 if I use getCustomFieldObject and use the ID instead of name.
import com.atlassian.jira.component.ComponentAccessor |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The problem is just that getCustomFieldValue is declared as returning Object - see https://scriptrunner.adaptavist.com/latest/jira/#_providing_type_information
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jamie, could you explain this I'm not a coder and would like to use script, I have tried this in ira 6.4.4 and 7.1.9 with the same result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What's the result you're getting? I'm not sure what you need help with to be honest.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Jamie:
I'm a newbie on scripts, but your script doesn't work for me, also.
I get this error shown in the image.
Can you help, please?
Thanks.
Antonio.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is safe to ignore - it's just that we can't calculate what type of field is returned by getting the Sprint custom field value. We are working on something better.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, Jamie. So, waiting for news from Adaptavist.
Do you have an idea on when will this be available?
Greetings.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think you misunderstand me. The script should work right now. The type checking errors you can just ignore, or cast to the correct type, but that's more complex.
https://scriptrunner.adaptavist.com/latest/jira/#_static_type_checking
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
Is it possible to do the same with a "IF" to return the information of the "Active sprint" ?
Because currently the field returns to me the date of the first sprint in which my ticket was assigned.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1. If you are updating the field during transition - you don't need the scripted field - it would be ok to have readonly field
2. Please also think about development of your plugin with calculated field - as for me it can be easier maintained during upgrade routines.
https://developer.atlassian.com/display/JIRADEV/Creating+a+Custom+Field+Type
https://docs.atlassian.com/jira/latest/com/atlassian/jira/issue/customfields/impl/CalculatedCFType.html
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.