We are using SLA Powerbox for managing our SLA agreements. By ordering our issues based on the SLADate (Deadline) we want to establish the backlog of our issues.
However, sometimes it is required to fix issues earlier (manually setting the deadline). Since SLA Powerbox currently does not support the manual setting of the deadline, we try to copy the deadline to a normal date field. This is done in a custom listener listening on "Issue updated" events.
This is where things get interesting:
When updating the issue normally (not triggering a change of the SLA goal) everything works as expected.
However when the update recalculates the SLA goal, the code below takes the old deadline instead of the new one.
The code looks as follows:
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def delivery_date_READ = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'SLAPOWERBOX Deadline'}
def delivery_date_write = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Manual Deadline'}
def new_value = issue.getCustomFieldValue(delivery_date_READ)
def old_value = issue.getCustomFieldValue(delivery_date_write)
def modified_deliver_value = new ModifiedValue(old_value, new_value)
def changer_one = new DefaultIssueChangeHolder()
delivery_date_write.updateValue(null, issue, modified_deliver_value, changer_one)
It seems that the code in the listener is executed before the SLA goal is calculated. Is there any way to postpone the execution?