Email multiple attachments
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
})
10 replies
- 
  attachments:[xbol,xinv] Steven 
- 
   
- 
  maybe since xbol is a loop with multiple values by itself 
- 
  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 
- 
  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!
- 
  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. 
- 
  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? 
- 
  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 
- 
  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 
- 
  Regardless of using or not the sleep () function does not work the first time. With the code that I have when I click once, it creates the pdf document and attaches it to the record. In addition to this, send an email without an attachment. If I click the button with the same code again, it sends the email with the attached file correctly. 
 Any more ideas?
Content aside
- 4 yrs agoLast active
- 10Replies
- 777Views

