I have a custom field for RAG status (BRAG rating) and scripted field for RAID score and I update the RAG status within the scripting for RAID score as follows:
def bragField = customFieldManager.getCustomFieldObjects(issue).find {it.name == "BRAG Rating"}
def fieldConfig = bragField.getRelevantConfig(issue)
def bragValue = optionsManager.getOptions(fieldConfig).getOptionForValue(bragString, null)
bragField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(bragField), bragValue),changeHolder)
This works just fine and I can search and sort by BRAG rating without problems. Now my users want to automate a Trend field based on whether the BRAG rating has gone up, down or remained the same over the past week. I had thought to just look at the history of the BRAG rating field to calculate this but I now notice that there are no history items being stored.
Is there something I need to do in addition to updateValue to cause the history to get updated?
I'm trying but I get 'Cannot find matching method' for both setCustomFieldValue and updateIssue which is why I have always used the updateValue method.
I suspect (I'm not really an OO programmer) that the problem lies with issue not being mutable but I don't know how to go about fixing that.
Bear in mind this code runs in a scripted field and is trying to update another field, not in the context of a transition.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, I found the solution, seems I was working on the right lines but I needed to make a mutable copy of the issue to use in the updates. This did the job:
def MutableIssue mIssue = issueManager. getIssueByCurrentKey(issue.key)
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.