Rename the attachment from record template pdf in the sendmail deluge script

Rename the attachment from record template pdf in the sendmail deluge script

Hello Zoho,

I urgently need a feature to rename record templates that I send via the sendmail feature. The program I created sends emails to clients with an invoices that have been created in the invoice database. If the user selects 3 invoice numbers, the program will send an email with attachments of the 3 selected invoices taken from the invoice database template like this:

sendmail
[
    from: "xxx@gmail.com"
    to: "xxx2@gmail.com"
    subject: "xxx"
    message: "xxx"
    Attachments: template:InvoiceTemplate:Invoice ID1 as PDF, template:InvoiceTemplate:Invoice ID2 as PDF, template:InvoiceTemplate:Invoice ID3 as PDF
]

The issue is that all three attachments have the same file name. Is there a way to change the names of these three files by extracting the invoice number strings from the database?