Hello,
I have the following JS saved into the Javascript's Folder:
var sendEmailWithAttachment = app.trustedFunction(function(doc) {
app.beginPriv(); // Inizia l'esecuzione privilegiata
var textName = doc.getField("TEXT").value;
var path = "G:\\Il mio Drive\\FOLDER\\" + textName;
var files = {
"Check Box1": path + "\\DOC1.pdf",
"Check Box2": path + "\\DOC2.pdf",
"Check Box3": path + "\\DOC3.pdf",
};
var email = {
cTo: "emailaddress@gmail.com",
cSubject: "This text" + textName,
cMsg: "Message to be written into the e-mail's body",
};
for (var checkbox in files) {
if (doc.getField(checkbox).value === "Yes") {
email.cAttachment = files[checkbox];
}
}
email.bUI = true;
this.mailDoc(email);
app.endPriv(); });
I call this function into my document through an action of a Button: sendEmailWithAttachment(this);
Unfortunately the magic doesn't happen, meaning: further the same doc from which I'm working, no further attachments appear into the e-mail.
Do you have any suggestions? Anytime I heard someone saying "this can't be done", I kept looking for a solution and I reached the task. So, please just help me understand what to do here. Thank you in advance