Hello,
i am trying to get the historical values of a custom field in scriptrunner. My intend is to find out if and how jira saves these values over time to determine if i can use it in EasyBI to plot the value over time. I didnt had success figuring it out directly in EasyBI.
I have looked at the ChangeHistoryManager but it looks like it only supports Issues not custom fields.
Any ideas or tips?
Thanks
Hi @Eren Dogan ,
Please look at an example from the eazyBI documentation page on how to import the field changes registered in a Scriptrunner field into eazyBI - https://docs.eazybi.com/eazybi/data-import/data-from-jira-apps/jira-calculated-and-scripted-custom-fields#Jiracalculatedandscriptedcustomfields-Originalestimatedhourshistory.
The particular example considers the system field "Original estimate". Still, the same concept should apply to custom fields.
Best,
Roberts // support@eazybi.com
Hi Robert,
thanks for your answer, thanks to Antoine i got to look at the values in JIRA/Scriptrunner console. Your suggetions unfortunately, isnt quite what a was looking for.
I added the "Import changes" option in sources with adding some advanced settings (https://docs.eazybi.com/eazybi/data-import/data-from-jira/import-issue-change-history#Importissuechangehistory-Customfielddimensions), but my problem is that the desired field is of type select list single and therefore there aren't any measures findable in regards to change and/or history like with number fields.
Do i have to create a calculated measure to access the change values and if so what be the correct way?
Thanks in advance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Eren Dogan ,
What type is the custom field in question? The parameters from the eazyBI documentation page you shared will work for the original custom field, if it is a single-value custom field.
Value change won't work with scripted custom fields. For that reasons, they have to be mapped to the Time dimension.
Best,
Roberts // support@eazybi.com
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The field type is a Select List Single, its used in a project as a drop down menu where three options are available and only one can be selected. The field is not being change by scripts, just by users.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Eren Dogan ,
In that case, you don't need an additional Scriptrunner custom field to import the change history into eazyBI.
Add the parameters mentioned in the eazyBI documentation page https://docs.eazybi.com/eazybi/data-import/data-from-jira/import-issue-change-history#Importissuechangehistory-Customfielddimensions into your eazyBI advanced settings.
After updating the eazyBI advanced settings, you can select the "Import value changes" option for this custom field together with the "Dimension" and "Property" options. Then, after importing the data, you can create reports displaying the historical information for the custom field.
To see the value change for one specific issue, you can create a report similar to the one below:
There you can see the custom field "T-shirt size" value changed from "M" to "XL" in October.
Another option is defining a calculated measure to look for the number of changes to the field. For example, in the case of the custom field "T-shirt size", the calculated measure formula could look similar to the one below:
([Measures].[Transitions to],
[Transition Field].[T-shirt size])
The measure "Transitions to" and the dimension Transition Field are hidden from the view as their potential is fully exposed in calculated measures. With the Issue dimension in rows, you can see the number of changes in the particular field for each issue. See the picture below:
The measure also includes issues created with the custom field. So, if a value was changed, the column for the dimension "All" member will have a value greater than one.
Best,
Roberts // support@eazybi.com
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 @Eren Dogan ,
Please see the following snippet that displays the values history of a custom field or a given jira issue :
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.history.ChangeItemBean
def issueManager = ComponentAccessor.getIssueManager()
def issue = issueManager.getIssueObject("JRA-XXX")
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def ch = changeHistoryManager.getChangeHistories(issue)
int count = 1
for(int i=0 ; i <= ch.size() - 1; i++){
for (ChangeItemBean bean:ch.get(i).getChangeItemBeans()){
if (bean.getField() == "Name of your custom field"){
log.info("value " + count + " : " + bean.getToString())
count++
}
}
}
Hope that helps.
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 @Antoine Berry . I tried this in the script console. It compiles but show no output. I inserted an issue key and a custom field name, but it returned no output.
Should this snippet return all change history of a specific custom field on that issue? Would it work for a multi-line text field? Thanks.
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.