Use case

Return the sum of the number of attachments in the sub-tasks of the issue.

Expression

Create and configure a Smart field using this expression in Jira expression mode:

issue.subtasks.map(subtask => subtask.attachments.length).reduce((a, b) => a + b, 0)