I want to attach multiple files that have been uploaded in a subform to a particular record in my email.
The code im using is below, I know this is close but it doesn't seem to work when i put the variable holding the files uploadfilecvar into the
attachments :file: part of the email.
If I use
attachments :file:
file.File_upload
then only one of one file is attached. How can i get this to email all of the files attached to a single email?
If i put sendmail inside the for loop then it will send 3 emails, I will get all the attachments but also 3 emails!
The error I get is
uploadfilevar does not exist in Approve
Approve is the form this code is in.
How can i put a variable in the attachments part or is there another way to do this?
- request = Purchase_Request_Form[ID == input.Request_ID];
- uploadfilevar = "";
- for each file in request.Build_Files
- {
- uploadfilevar = uploadfilevar + file.File_upload;
- }
- if(input.Email_Factory_Request)
- {
- sendmail
- [
- from:"email@email.com"
- to:"email@email.com"
- subject:"subject"
- message:"message"
- content type:HTML
- attachments :file: uploadfilevar
- ]
- }