How can I set a default End Date to a Contract?
Question
We need to send the contracts to SAP with an End Date predefined to "never" (in this case 31/12/9999).
Answer
if (cProcessor.isPrePhase()) {
Calendar cal = Calendar.getInstance()
cal.set(year:9999, month:11, date:31)
def DEFAULT = cal.getTime()
cProcessor.updateField("endDate", DEFAULT)
}
We finally implemented an enhanced version defaulting only on the first occurance this HeaderLogic is triggered:
if (cProcessor.isPrePhase() && cProcessor?.contractView?.additionalInfo1 != 1) { Calendar cal = Calendar.getInstance() cal.set(year:9999, month:11, date:31) def DEFAULT = cal.getTime() BigDecimal isDirty = 1 cProcessor.updateField("endDate", DEFAULT) cProcessor.updateField("additionalInfo1", isDirty) }