I want the recording, updating of change histroy and issue update event to trigger for any change in the custom fields of an issue through a single API call. Currently I am able to record, update the change histroy but issue update is not getting triggered. shown below is
1) The piece of code i have tried with
Map modifiedFields = issue.getModifiedFields();
DefaultIssueChangeHolder issueChangeHolder = new DefaultIssueChangeHolder();
for (Iterator iterator = modifiedFields.keySet().iterator(); iterator.hasNext();)
{
String fieldId = (String) iterator.next();
FieldManager fieldManager = ComponentManager.getInstance().getFieldManager();
if (fieldManager.isOrderableField(fieldId))
{
OrderableField field = fieldManager.getOrderableField(fieldId);
FieldLayoutItem fieldLayoutItem;
try
{
fieldLayoutItem = ComponentManager.getInstance().getFieldLayoutManager().
getFieldLayout(issue.getGenericValue()).getFieldLayoutItem(field);
final ModifiedValue modifiedValue = (ModifiedValue) modifiedFields.get(fieldId);
field.updateValue(fieldLayoutItem, issue, modifiedValue, issueChangeHolder);
}
catch (FieldLayoutStorageException e)
{
// TODO Auto-generated catch block
}
}
}
2) other piece of code I tried is
public void updateIssue(MutableIssue issueObject, OperationContext operationContext, User user, ErrorCollection errors, I18nHelper i18n)
throws RemoteException
{
try
{
webwork.dispatcher.ActionResult aResult = updateFieldsHelperBean.updateIssue(issueObject, operationContext, user, errors, i18n);
ActionUtils.checkForErrors(aResult);
}
catch(Throwable e)
{
log.error((new StringBuilder()).append("Exception occurred editing issue: ").append(e).toString(), e);
throw new RemoteException((new StringBuilder()).append("Error occurred editing issue: ").append(errors.getErrors()).append(" ").append(errors.getErrorMessages()).toString(), e);
}
}