DateTimeFormatter fmt = ISODateTimeFormat.dateTime();
DateTime scheduleTime = fmt.parseDateTime(ctx.trigger.triggered_time.toString());
Period period = ISOPeriodFormat.standard().parsePeriod("P" + range);
DateTime beginTime = scheduleTime.minus(period);
return beginTime;
I write such a groovy script, but as document stated, that will create a new payload with a single field beginTime. But I want to use ctx.trigger.triggered_time also(now my email title is error occurs in [{{beginTime}}, {{ctx.trigger.scheduled_time}}]). What is the prefer way to handle that? Return a class which contains both instead?
EDIT: Sorry for my carelessness, I saw this in the doc:
The executed script may either return a valid model that is the equivalent of a Java™ Map or a JSON object (you will need to consult the documentation of the specific scripting language to find out what this construct is). Any other value that is returned will be assigned and accessible to/via the _value variable.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.