Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save azakordonets/737e6e99c1d0dec87563 to your computer and use it in GitHub Desktop.

Select an option

Save azakordonets/737e6e99c1d0dec87563 to your computer and use it in GitHub Desktop.
protected boolean fieldWasChanged(String fieldName, IssueEvent issueEvent, String fieldValue) throws GenericEntityException {
boolean result = false;
List<GenericValue> changeItemList = issueEvent.getChangeLog().getRelated("ChildChangeItem");
Iterator<GenericValue> changeItemListIterator = changeItemList.iterator();
while (changeItemListIterator.hasNext()) {
GenericValue changeItem = (GenericValue) changeItemListIterator.next();
String currentFieldName = changeItem.get("field").toString();
if (currentFieldName.equals(fieldName)) // Name of custom field.
{
Object oldValue = changeItem.get("oldstring");
Object newValue = changeItem.get("newstring");
if (oldValue!= null && newValue != null){
if (!oldValue.equals(newValue) && newValue.equals(fieldValue)) result = true;
break;
}else if (oldValue == null && newValue != null) {
if (newValue.equals(fieldValue)) result = true;
break;
}
}
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment