Goal: identify all stories where Description field changed after certain date.
My thinking:
- Create a custom field (number) and update counter each time Description is updated
- Have ScriptRunner update the custom field on each Description update event
- Use JQL and generate report (the easy part)
STEP 1: Created custom field
"id": "customfield_16800",
"name": "DescriptionChange",
"custom": true,
"orderable": true,
"navigable": true,
"searchable": true,
"clauseNames": [
"cf[16800]",
"DescriptionChange"
],
"schema": {
"type": "number",
"custom": "com.atlassian.jira.plugin.system.customfieldtypes:float",
"customId": 16800
}
STEP 2: created Custom Listener (All Projects, "All Issue Events")
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
Issue issue = event.issue
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def change = event?.getChangeLog()?.getRelated("ChildChangeItem").find {it.field == "Description"}
if (change)
{
def tgtField = customFieldManager.getCustomFieldObjects(issue).find {it.name == "DescriptionChange"}
def changeHolder = new DefaultIssueChangeHolder()
tgtField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(tgtField), 1), changeHolder)
}
else return
The script doesn not update Description field. I am new to ScriptRunner and need some help with the script.
Thanks in advance!