Create PDF and send Email automated

Tagged: 

Viewing 20 reply threads
  • Author
    Posts
  • November 20, 2020 at 9:04 AM #42666

    Brecht DHeere
    Participant

    Hi,

    I know it is possible to create a pdf from a layout with the print function but is it also possible that Tapforms created the pdf and I just have to do one click to send it to the emailadress that is specified in a field of that record?

    Thanks,
    Brecht

    November 20, 2020 at 1:42 PM #42672

    Brendan
    Keymaster

    Hi Brecht,

    I’m sorry but there’s no direct function for this, but you can use the Mail PDF function on the Print panel. But then you do have to manually enter in the email address to send it to.

    Thanks,

    Brendan

    November 23, 2020 at 4:08 AM #42702

    Brecht DHeere
    Participant

    OK, thank you for the reply!

    March 21, 2023 at 2:11 PM #49178

    Charlie
    Participant

    is their a script to do what Brecht ask for? It would be much easier than Mail PDF and do it manually.

    March 21, 2023 at 3:42 PM #49179

    Daniel Leu
    Participant

    Since this seems to be useful, I put something together. Please have a look at https://lab.danielleu.com/blog/sending-record-by-email/

    Please let me know how this works for you.

    March 23, 2023 at 9:59 AM #49193

    Chris Ju
    Participant

    Thanks, that’s useful!

    April 1, 2023 at 11:29 AM #49227

    Charlie
    Participant

    Daniel Thanks for the script. I have linked fields that don’t show up as they do on the computer. Even if i make a pdf the field don’t show the linked form. So at the moment i’m stuck. But thanks for support Daniel

    April 1, 2023 at 3:22 PM #49234

    Daniel Leu
    Participant

    Hi Charlie,

    As it says, “this function copies all fields that represent a primitive data
    type from the currentRecord”. A linked field is not a primitive data structure. Can you share your form template so I can have a look at it? Thanks!

    • This reply was modified 1 year, 7 months ago by Daniel Leu.
    • This reply was modified 1 year, 7 months ago by Daniel Leu.
    April 1, 2023 at 10:43 PM #49237

    Charlie
    Participant

    Hi Daniel

    Is it a tfarc file you mean? I took a screenshoot of the default page. The fields with symbols like ”kameror” is a many to many form. On the cumputer I see a linked form with text on my phone is like this. If its possible to get whats in the field as printed text or in a PDF form should be great. Then I can Airdrop this form to my customers. It’s a rentalform for equppment.

    Attachments:
    You must be logged in to view attached files.
    April 3, 2023 at 12:51 AM #49253

    Charlie
    Participant

    Hi Daniel.

    I managed to export a template. I hope you have time the check it out.

    Attachments:
    You must be logged in to view attached files.
    April 3, 2023 at 11:23 AM #49259

    Daniel Leu
    Participant

    Hi Charlie,

    Thank you for the form. I’ve enhanced the script a bit to process date fields as such, include the name field from the contact, and to report child records as well. Please note that I only did some minimal testing.

    I have updated the script over on https://lab.danielleu.com/blog/sending-record-by-email/

    Your top-form contains links from other forms and not to other forms! You will need to update line 32 from } else if (f.fieldType == "form") { to } else if (f.fieldType == "from-form") {.

    April 3, 2023 at 12:59 PM #49260

    Charlie
    Participant

    Hi Daniel

    Thanks for your support. I got the name and all the field that is not linked to other forms to be copied to mail. That’s great. I also tried to test to change field 32. But i don’t get info from other forms. Like ”kameror”, ”ljud”, ”grip” and so on. I am useless to script writing Thanks for your time and work.

    April 3, 2023 at 2:21 PM #49261

    Daniel Leu
    Participant

    For you, line 32 has to be } else if (f.fieldType == "from_form") {

    Then I get something like:

    Namn: Daniel Leu
    Klass: ES21B
    Återlämnad: Ja
    Bokningsdatum: Wed Apr 12 2023
    utlåningsdatum: Thu Jan 01 1970
    Kamera: Canon XA65
    Kameror: 
       Kamera: Kamera 1
       Kort id: #345345
    Återlämningsdatum: Tue Apr 18 2023
    Stativ: En bensstativ
    Bom: 5
    SD CARD: NEJ
    Kommentar: some comment
    Ljus: 
       Ljus: Light
       Kort id: Light Id
       Inkommen: true
    Övrigt: XLR kabel
    Utlånad av: xxxx
    Mottagen av: xxx 

    Can you copy the output from the console? This might help.

    • This reply was modified 1 year, 7 months ago by Daniel Leu.
    • This reply was modified 1 year, 7 months ago by Daniel Leu.
    • This reply was modified 1 year, 7 months ago by Daniel Leu.
    April 3, 2023 at 3:23 PM #49268

    Charlie
    Participant

    I check this tomorrow. Looks promiseing.

    April 4, 2023 at 5:39 AM #49285

    Charlie
    Participant

    Thanks Daniel.

    It’s almost there. I have some duplicates of similar names. Like ljud: Ljud, Ljus: ljus, kamera… etc. Alson i have checkmarkfield ”inkommen” marked true or false. I wonder how to, not have ”inkommen”, true in the mail. Signature is jpeg file that the script cant translate. Small issues could be big script problems. Any way Happy easter.

    April 4, 2023 at 9:23 AM #49287

    Daniel Leu
    Participant

    Hi Charlie, with duplicates of similar names do you mean the two Ljus in this example?

    Ljus: 
       Ljus: Light
       Kort id: Light Id
       Inkommen: true

    This is because the field in the parent form is called Ljus and then there is another field in the child form called Ljus.

    Sorry, there is nothing I can do about the signature image. Well, I could provide the filename, but I don’t think that this is what you’re after.

    So you don’t want to have the “inkommen” field at all?

    April 4, 2023 at 10:28 AM #49289

    Charlie
    Participant

    Hi Daniel

    Ok i got it about the name from parent and childform. Ir’s a bummer.😀 Correctly i don’t want the ”inkommen” field at all. Thanks for your great support.

    Hopefully Brendan have a solution on a PDF print in the next update

    April 4, 2023 at 10:30 AM #49290

    Charlie
    Participant

    Daniel
    I missunderstod. Its the first ljus that can go away

    April 4, 2023 at 10:50 AM #49291

    Daniel Leu
    Participant

    You can use this to remove “Inkommen” from your email body:

    function Mail_Record() {
       let emailBody = copyRecordToText(record);
       const matchFilter = /Inkommen/g;
       emailBody = emailBody.split("\n").filter(item => !item.match(matchFilter)).join("\n");
       console.log("============= Email Body\n" + emailBody);
       let emailUrl = createEmailURL("", "", "", "Email Record", emailBody);
       // Send email
       Utils.openUrl(emailUrl);
    }
    April 4, 2023 at 10:59 AM #49292

    Charlie
    Participant

    Hi Daniel

    Shall I use this and replace from line 71? And the first ”ljus”, ”kameror”….. Is it possible to remove that duplicate in the mail form?

    April 5, 2023 at 5:17 PM #49294

    Daniel Leu
    Participant

    Sorry, I’m traveling right now. Is it possible? Yes. But maybe it’s easier to change the naming. “Rented Lens” or just “name” in the lens form.

    April 6, 2023 at 1:56 AM #49295

    Charlie
    Participant

    Thanks Daniel for your support. Have a nice trip

Viewing 20 reply threads

You must be logged in to reply to this topic.