Let's say you want to order your JQL by date of last attachment. You may create something relevant to the following:
project = "XXXX" and numberOfAttachments >0 ORDER BY LastAttachmentDate
However, I noticed it does not count the attachments coming from users directly drag-dropping their attachment item in a comment that is being edited. The attachment is added to the attachments list of the JIRA, but it does not trigger the update of LastAttachmentDate.
I am looking for a turnaround or a bug fix, because many of my users attach their stuff directly in the comment their are editing for a proper historic display of their attachments in the comments section.