Email multiple attachments

M

i would like to attache multiple attachemets to one email

this works but only gives me the xbol if i add 

attachments: xbol+xinv it does not work

 


let xid := Id;
let xbol := for i in 'Pickup Shipments' do
importFile(i, printAndSaveRecord(i, "BOL"), i.'Shipment Number' + ".pdf")
end;
let xinv := for i in 'Pickup Shipments' do
importFile(i, printAndSaveRecord(i, "Commercial Invoice"), i.'Shipment Number' + ".pdf")
end;
sendEmail({
from: userEmail(user()),
to: text(userEmail(user())),
subject: "Ninox",
text: text("222"),
attachments: xbol
})

 


 

Ninox Profile

attachments:[xbol,xinv]

Steven

M

Capture

M

maybe since xbol is a loop with multiple values by itself 

 

Ninox Profile

Sorry, I didn't look at your code in detail.

I suppose there are no other attachments in the record except those two made with the code, then you can use:

let att := files(this);
...........
........... (other code)
...........
attachments: att
})

Steven

Ninox Profile

 

In my case I have programmed a button with the following code:

let myReport: = importFile (this, printAndSaveRecord (this, "Report"), "report" + this.'Data of data '+ ".pdf");
let att: = files (this);
sendEmail ({
from: text (userEmail ()),
to: text (IssueEmailto),
subject: "Warehouse report",
text: "I am attaching the warehouse report",
html: "<h1> Stock status </h1> <i> Antonio </i>",
attachments: att
})

When I click once it creates the pdf file as an attachment to the record and sends the email without an attachment.
When I press a second time it does send the attached file.

What can I do so that with a single click, the file is created, attached to the record, and sent by e-mail?
Thanks!

Ninox Profile

The pdf is created but not available when sending the mail. After creating the pdf you can use the function sleep() to create a pauze till the pdf is available. E.g: sleep (3000) gives 3 seconds pauze.

Ninox Profile

I have made the following change in the code:

let myReport: = importFile (this, printAndSaveRecord (this, "Report"), "report.pdf");
sleep (3000);
let att: = files (this);
sendEmail ({
from: text (userEmail ()),
to: text (IssueEmailto),
subject: "Warehouse report",
text: "I am attaching the warehouse report",
html: "<h1> Stock status </h1> <i> Antonio </i>",
attachments: att
})

 

Now I get the following message:

ENOENT: no such file or directory

What I can do?

Ninox Profile

If this helps, I see in your code let att: = files (this) too much spaces, after':' and after 'files',try this:
let att:= files(this);

Steven

M

what happens is that the attachements created from the code are only bieng attached to the child records not to the parent record , so therefore 

let att:= files(this); does not have any attachments 

1 2
Reply