Our stack was updated from version 7.9.3 to version 7.17.9 and I am having to convert some of the scripted fields to the new "runtime" field as it shows scripted fields as depreciated. It looks like some of the time functions have changed and i am having a hard time converting. How can i accomplish the same with a runtime field?
Instant CurDate = Instant.ofEpochMilli(new Date().getTime());
long FakeDate = 956851031000L;
Instant Ddate = doc["d_date"].empty ? Instant.ofEpochMilli(FakeDate) : Instant.ofEpochMilli(doc["d_date"].value.getMillis());
Instant Rdate = doc["r_date"].empty ? Instant.ofEpochMilli(FakeDate) : Instant.ofEpochMilli(doc["r_date"].value.getMillis());
if (doc["d_date"].value == null || !doc.containsKey('d_date') || doc["d_date"].empty) {
return false;
} else if (CurDate.isAfter(Ddate) && doc['status'].value.contains('Open')) {
return true
} else if (Rdate.isAfter(Ddate) && doc['status'].value.contains('Closed')) {
return true;
} else {
return false;
}