0

Bug button

Can someone tell me what is wrong with my button? I would like my button to generate a pdf file and then send the pdf by email as an attachment.

When I create 2 buttons, one that generates the pdf then another that sends the email, then everything works. On the other hand, by integrating everything into a single button and with the same formulas as with the separate buttons, it no longer works.

 The document is generated on line 25 and the email is sent from line 30

let me := this;
let messagePerso := "Assurez-vous que les adresses mails soit correctes !

Email principal : <variable email principal>
Email secondaire : <variable email secondaire>";
let myvar := messagePerso;
myvar := replace(myvar, "<variable email principal>", text('E-mail principal'));
myvar := replace(myvar, "<variable email secondaire>", text('E-mail secondaire'));
myvar;
let title := "Vérification de l'email";
let message := myvar;
let answerOptions := ["Envoyer", "Annuler"];
if dialog(title, message, answerOptions) = "Envoyer" then
    ---
Générer les textes
    ---;
    let FormulationMail := "Bonjour " + 'Prénom' +
        ",<br><br>Veuillez trouver ci-jointe une information importante concernant le traitement de vos données.<br><br>" +
        Entreprise.'Signature des emails';
    let ObjetMail := "Information sur le traitement de vos données";
    let nomDoc := "Information sur le traitement des données‧pdf";
    ---
Générer les documents pdf
    ---;
    'Doc traitement des données' := importFile(this, printAndSaveRecord(this, "Traitement des données"), nomDoc);
    sleep(2000);
    ---
Envoyer par email
    ---;
    sendEmail({
        from: Entreprise.'E-mail',
        to: 'E-mail principal',
        cc: 'E-mail secondaire',
        cci: Entreprise.'E-mail',
        subject: ObjetMail,
        text: FormulationMail,
        html: FormulationMail,
        attachments: ['Doc traitement des données']
    });
    ---
Enregistrer l'échange
    ---;
    let newRecEchange := (create 'Échanges');
    newRecEchange.(Compte := this.Compte);
    newRecEchange.('Type de contact' := 2);
    newRecEchange.('Canal de contact' := 2);
    newRecEchange.(Type := 6);
    newRecEchange.(Titre := ObjetMail);
    newRecEchange.(Commentaires := FormulationMail)
end;
'Informé du traitement des données' := true

Also, is there a way to avoid generating/storing the pdf file in an image field? Currently the image field in which I put the generated pdf is only used for this and I do not need to keep this document once sent by email.

Thanks for your help

1 reply

null
    • Mel_Charles
    • 10 mths ago
    • Reported - view

    you don't say what part no longer works

    None of it or does it geberate the file but not send the email or what?

    also Ninox will want to pick up the image store to be able to send so you could delete the stored pdf immeditaly after sending

Content aside

  • Status Answered
  • 10 mths agoLast active
  • 1Replies
  • 62Views
  • 2 Following