Running this script as a post function
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.ComponentManager
import org.apache.log4j.Logger
def log = Logger.getLogger("com.acme.workflows")
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
def eDate = customFieldManager.getCustomFieldObjectByName("End Date")
def eDatev = issue.getCustomFieldValue(eDate)
if ( eDatev == null )
{ log.warn "End Date is set to " + eDatev def sDate = customFieldManager.getCustomFieldObjectByName("Implementation Date") def sDatev = issue.getCustomFieldValue(sDate) log.warn "Implementation Date is set to " + sDatev issue.setCustomFieldValue( eDate, sDatev) }
eDatev = issue.getCustomFieldValue(eDate)
log.warn "End Date is set to " + eDatev
The log file reads
2019-03-15 11:14:58,980 WARN [acme.workflows]: End Date is set to null
2019-03-15 11:14:58,980 WARN [acme.workflows]: Implementation Date is set to 2019-03-20 00:00:00.0
2019-03-15 11:14:58,980 WARN [acme.workflows]: End Date is set to 2019-03-20 00:00:00.0
This shows the End Date is changed, as expected. But the value isn't saved. I have found this reference
https://community.atlassian.com/t5/Jira-questions/Scripted-post-function-to-set-a-date-value-in-custom-field/qaq-p/368278
It seems to suggest that the value will be saved. It is the 2nd item in a post function
What am I missing?