7 Replies Latest reply on Jun 17, 2017 8:36 PM by jaythefirst

    Form letter vs email script


      Hi, Im not asking for somebody to sort this for me, just point me in the right direction to find it in the help files.


      I want to create a button next to a field AGENT_EMAIL (which contains the agents email address)

      (I know how to create the button and set trigger)


      That button will bring up a form or email that is part standard text and information from fields.  (I know how to do merge fields with name field etc.)


      And several questions the user must answer.

      (This is where I’m confused)


      The email will tell the recipient


      Id like to book you for a job……………

      On date…………….

      In country…………….

      My mobile is………….


      The user needs to fill the dots.


      Should I be thinking of a form letter, or something that becomes a .pdf  or a script that interacts?


      Whats the overall name for the task i want to perform?

        • 1. Re: Form letter vs email script

          Using merge fields only works if you plan to save a PDF of the form letter and send it as an attachment. If you want to generate the form letter as the body of an email, you have to use other means. Then there's the maintenance side of the equation. Some solutions to this problem are pretty easy to set up, but any time the client finds that they need to edit the basic "form text", they have to get someone with developer access and skills to make the update.


          Other approaches take a lot more effort to set up, but allow at least basic level edits to the form text to be a data entry task that does not require a developer to do.


          With any of the approaches, the last part of the letter--where the user needs to fill in information, you'll need to set up a layout with text fields where they can enter this information. Once you have this info in fields, you can insert it into your form letter.


          A basic out line of methods:


          Merge fields on a layout. Works, but have to save as PDF and attach, plus, takes a developer editing layout text to modify the form text.


          A text calculation with the form text entered as literal text to be concatenated with data from fields in your solution. This looks like this:


          "Dear " & Table::SaluationField & ",¶¶" & "Thank You for..." and so on.


          This can be entered directly into the Send Mail Dialog or set up as a calculation field or the calculated result of a set field step. In the latter two cases, your send mail step is then a calculation that just references this field. The latter options allow a user to preview the result before you send the email. This method also require developer intervention should the user decide that the form text needs to be changed.


          Set up the form text in a text field like this:


          Dear <<Salutation>>,


          Thank you for


          When you want to generate your message, you use the substitute function to replace placeholder text like <<Salutation>> with data from your solution:


          Substitute ( Table::FormText ; [ "<<Salutation>>" ; Table::Salutation] ; [ ..put the next entry for substitution here ] )


          This is more complex, but makes editing the text in FormText a data entry process that does not necessarily require a developer to do.

          1 of 1 people found this helpful
          • 3. Re: Form letter vs email script

            So I think I need to adapt something like this, but need to prompt the user to fill in a couple of fields, then return to saving the .pdf, or in a join table. Once its sent it doesn't need to be edited. Its just an advise email.

            Example 2

            Saves the current record as a PDF, then emails the PDF to the address in the Email field in the current record.

            Go to Layout ["Print Invoices"]
            Save Records as PDF [Restore; No dialog; "Invoice.pdf"; Current record]
            Send Mail [Send via E-mail Client; No dialog; To: Customers::Email; Subject: Invoices::Summary; Message: "Dear Customer,¶¶Thank you for your business. Your invoice is attached."; "Invoice.pdf"]
            Go to Layout [original layout]

            • 4. Re: Form letter vs email script

              In reading the last two replies, do you have a question there or do you now have this figured out?


              What you show is consistent with what I understood to be the problem and for which I have described three different ways to get that to work, two that are "simple but brittle" and one that is "more complicated, but less brittle". If you have further questions, please let me know.

              1 of 1 people found this helpful
              • 5. Re: Form letter vs email script

                Im slowly tying it out.



                • 6. Re: Form letter vs email script

                  I see you have marked the question as correct. I'm just looking from another side of the coin(s) and others may also benefit:

                  GetLayoutObjectAttribute("objName"; "content")

                  * https://www.filemaker.com/help/16/fmp/en/#page/FMP_Help/getlayoutobjectattribute.html

                  says this:

                  text objects - returns the text (including text from merge fields).

                  So a layout "text" object with merge fields can be 'evalutated' with the above function, if the layout object is named. You can then put that into the body of the email. No PDF needed.


                  As with any emailing from FM, YMMV, of course. How a layout looks (in Preview mode), can be a PDF attachment if that is desired. I often do a combination of both (depending on the complexity of the layout, portals for example).


                  I wrote this when I needed a "plain text" table of related data to be in the body of the email:




                  1 of 1 people found this helpful
                  • 7. Re: Form letter vs email script

                    Thanks Beverly

                    I think I may need something as simple as creating a layout with merge  fields a few fields that will be standard text from a table.

                    Then a few fields that the user can fill.

                    Then a button sending that record with only these new fields in it.

                    Send without dialogue.

                    Clear user fields on exit.


                    Playing with it today.