We have a Script Listener that updates fields but doesn't update the History of the Issue. Per Payne on an earlier question "...EVERY change (except comments and changes to comments) SHOULD be recorded in the History tab."
This is a snippet of the Groovy code:
---------------------------------------------------------------------------------------
/*
* Fires when a Issue Link is created.
* Exits if Linked to Issue is not Initiative / Feature / Epic
* Copies Custom Fields down from Linked Issue
*/
// imports...
// Setup Custom Field Manager
def CustomFieldManager = ComponentAccessor.getCustomFieldManager()
// Grab Event
def event = event as IssueLinkCreatedEvent
// sourceIssue is really the Issue that is being Linked to.
def sourceIssue = event.getIssueLink().getSourceObject()
log.info("sourceIssue: " + sourceIssue.key)
// Exit if not Initiative / Feature / Epic
if (sourceIssue.issueType.name != "Epic" &&
sourceIssue.issueType.name != "Feature" &&
sourceIssue.issueType.name != "Initiative") {
log.info("Exiting ... sourceIssue type of: " + sourceIssue.issueType.name + " is not Epic / Feature / Initiative")
return 0
}
// Which makes the Destination object really the issue
def issue = event.getIssueLink().getDestinationObject()
log.info("issue: " + issue.key)
/**
* Workfront Project
*/
def CfWorkFrontProject = CustomFieldManager.getCustomFieldObject('customfield_10703')
log.info("CfWorkFrontProject")
// Copy if target Field IS Empty and source field is NOT Emtpy
if(!issue.getCustomFieldValue(CfWorkFrontProject) &&
sourceIssue.getCustomFieldValue(CfWorkFrontProject)
) {
def oldData = issue.getCustomFieldValue(CfWorkFrontProject)
def newData = sourceIssue.getCustomFieldValue(CfWorkFrontProject)
CfWorkFrontProject.updateValue(null, issue, new ModifiedValue(oldData, newData), new DefaultIssueChangeHolder());
log.info("Workfront Project updated to: " + newData)
} else {
log.info ("Not CfWorkFrontProject && not value in CfWorkFrontProject")
}
return
---------------------------------------------------------------------------------------
When the listener is triggered, it does update the CfWorkFrontProject field but there's no corresponding log entry and we have no clue why.
Are we updating custom fields incorrectly?
My colleague and I are very new to Jira/ScriptRunner/Groovy and so may be writing some very offensive code. For that we apologize.