Hi,
I have Scriptrunner script that reads a an Epic does a calculation and writes to a custom field in the Epic. This script gets read when epic is viewed
The custom field works gets updated in the epic correctly, however when I use the custom field in a Roadmap plan, it never updates unless I go into the field in roadmaps change the value and click Review. For the benefit of testing I have set the CustomField as Text and Free Text searchable.
My code snippet as follows:
if (mIssue.issueTypeObject.name == "Epic") {
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager()
CustomField customField = customFieldManager.getCustomFieldObject(EpicTotalOriginalEstimateField)
def issueManager = ComponentAccessor.getIssueManager()
// def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
if (customField != null) {
//def changeHolder = new DefaultIssueChangeHolder()
// Double db = daysForEpic
String db = ""+daysForEpic
mIssue.setCustomFieldValue(customField, daysForEpic)
customField.updateValue(null, mIssue, new ModifiedValue(cfieldValue, db),changeHolder)
//MutableIssue issueMute = issueMger.getIssueObject("LS-11050") as MutableIssue
//issueMute.setCustomFieldValue(customField, "100")
//ComponentAccessor.getIssueManager().updateIssue(user, issueMute, EventDispatchOption.ISSUE_UPDATED, false)
// issueMger.updateIssue(user, mIssue, EventDispatchOption.DO_NOT_DISPATCH, false)
}I have called both setCustomFieldValue and updateValue
If I call updateIssue (as commented out) it kills my jira server. We are doing this because of the limitations of Advance Roadmaps that cant display calculated Custom fields.
I would appreciate any help in this.
Thanks,
-Mark