4 Replies Latest reply on Oct 27, 2016 7:50 AM by beverly

    HOW DO I INCLUDE MAIL MERGE FIELDS IN AN EMAIL

    DavidCushworth

      I want to send a pre formatted email to new clients, but include in the body of the text their personal information, a la merge mail style.

       

      I have tried inserting the database field name at certain points, such as Dear Client::First Name but it doesn't pick up the field information.

       

      So, is this at all possible, and if so how?

       

      Thanks

        • 1. Re: HOW DO I INCLUDE MAIL MERGE FIELDS IN AN EMAIL
          beverly

          The body of the message is a field (a text field or calculated field). Create a calculation field:

          msg_body = "Dear " & Client::First Name & ..

           

          then select that field for the send mail dialog.

           

          In addition, you can set a variable with the same calculated text and set the body of the message to that variable.

           

          Set Variable ( $msg_body ; "Dear " & Client::First Name & ... )

           

          the variable (set by script) does not store the values beyond the script, so no field to create.

           

          beverly

          • 2. Re: HOW DO I INCLUDE MAIL MERGE FIELDS IN AN EMAIL
            philmodjunk

            Once you get that method working, you might want to make this something more flexible should you discover the need to modify the basic message in the future.

             

            Set up a text field in a dedicated table of such messages where you enter your email message text like this:

             

            Dear <<Client First Name>>,

             

            Thank you for... (and so forth all in one field).

             

            Then, to put this into the body of an email, you do this:

            Substitute ( MessageTable::Textfield ; ["<<Client First Name>>" ; Client::FirstName] ; [<<next field placholderhere ; Table::field ] )

            You can use one square bracketed substitution pair for each place where you need to replace a <<placeholder>> with data from your database.

             

            The advantage to this approach is that the message can undergo simple edits without the need for you the developer to come in and redefine a calculation as the update is now a data entry change.

            • 3. Re: HOW DO I INCLUDE MAIL MERGE FIELDS IN AN EMAIL
              DavidCushworth

              The variable option worked like a dream. Thank you

              • 4. Re: HOW DO I INCLUDE MAIL MERGE FIELDS IN AN EMAIL
                beverly

                awesome! a bonus of putting the variable into the body?

                you can have several canned messages (calculated or not) and branch in a script to set the one needed into the variable. The Send Mail step need never change, as the variable is set by branching.

                beverly