Trouble emailing PDF attachment
Hello, I'm trying to send emails with an attached copy of a record.
I've read many of the threads, and I've tried using "do as server", but I get an empty attachment when I do it this way. Here is my code. Please let me know if I can do anything to make this work. I'm inside the Ninox app, but using a Ninox account. When I run it without doing as server, I get an error that the file is not yet available, and when I do as server I get a file called "attachment-1.*". I have no problem if I try to send a file that's already created and attached to a record.
Thank you,
Matthew
if Students.'Email practice plan' = true thenlet myName := "Lastlesson.pdf";do as serverlet thefile := null;importFile(this, printAndSaveRecord(this, "Lessons"), myName);thefile := file(this, myName);let myEmail := text(userEmail(user()));sendEmail({from: myEmail,to: "aaaaa@bbb.ccc",subject: "Practice plan " + Students.'Student First Name' + "(" + LessonTime + ")",text: "Here is this week's practice plan",html: "<i>Here is this week's practice plan </i><br>Matthew",attachments: thefile})endend
1 reply
-
Hello lanematthewc
I too was having the same issue. I have made it work by putting an alert or dialog command inbetween the Printandsave command and the email command. Mine just says alert("Email Sent").
Can't answer why this works though.
Content aside
- 4 yrs agoLast active
- 1Replies
- 1022Views
