0

I get an error after clicking button to send e-mail with attachment: can anybody tell me what I'm doing wrong?

Hi all,

 

Can somebody assist, as I don't see what I'm doing wrong.

I have a table called RELATIONS. It has a child table CONTACTS. Every contact has a STATUS (choice: active or inactive at the company), an e-mail address and a Yes/No whether or not they want to receice my invoices.

In the form for my table INVOICES I have a button to e-mail the invoice as an attachment to the company contacts, that are active at the company and want to be the one(s) receicing invoices. I have coded the button like this:

let x := Id;
let xCust := 'INVOICE TO';
let xContact := concat(select CONTACTS where RELATIONS = xCust and STATUS = 1 and 'E-MAIL INVOICES' = true);
let xPDF := printAndSaveRecord(this, "INVOICE");
let xFile := 'INVOICE NUMBER' + ".pdf";
importFile(this, xPDF, xFile);
sendEmail({
from: userEmail(),
to: xContact,
subject: 'INVOICE NUMBER',
text: " ",
attachments: file(this, xFile),
html: "Dear " + 'INVOICE TO'.CONTACTS.TITLE + " " + 'INVOICE TO'.CONTACTS.'LAST NAME' + ",<br><br>Please find attached invoice " + ".<br><br>Thank you and best regards,<br><br>" + user()
})

The code seems to contain no errors and I can save it without problems. But upon clicking the button, I get a popup error: Invalid paramater: to ("4"). 

First time I've seen this and I don't have a clue. Please help! :)

Thanks!

1 reply

null
    • Martijn_Burghoorn
    • 2 yrs ago
    • Reported - view

    Never mind all... Sorry to bother. I found it... forgot the 'E-MAIL' field after concat(select CONTACTS where RELATIONS = xCust and STATUS = 1 and 'E-MAIL INVOICES' = true). Code shoud read:

     

    concat((select CONTACTS where RELATIONS = xCust and STATUS = 1 and 'E-MAIL INVOICES' = true).'E-MAIL')

     

    silly me...

Content aside

  • 2 yrs agoLast active
  • 1Replies
  • 166Views