Originally asked by Ariel Aguilar on 05 August 2022 (original question)
Question raised: How do I only send attachments which were attached within 12hrs ?
Originally asked by Ariel Aguilar on 05 August 2022 (original question)
Question raised: How do I only send attachments which were attached within 12hrs ?
Answer by Ariel Aguilar on 05 August 2022
You can do:
//get system current time in milliseconds
long currentTimeMilliseconds = System.currentTimeMillis()
//43200000 = 12hours in milliseconds
//send only attachments within 12 hours elapsed in milliseconds
replica.attachments = issue.attachments.findAll { attachment -> (currentTimeMilliseconds - attachment.created.getTime() <= 43200000)
}