9 Replies Latest reply on Jan 25, 2008 2:49 PM by Günter Schenk

    email form data from linked transaction

    Level 1
      I have a linked transaction that unites two forms that insert into different database tables. I want to email the data to someone. Is this possible?

      I have tried adding a new sendEmail trigger for the second insert but that produces two different emails.

      How can I unite all the data from all insert transactions into a single email?

      There is a question like this on the old Interakt forum but it ends without resolution.
        • 1. Re: email form data from linked transaction
          Günter Schenk Level 4
          Hi altery,

          I recently tried the same and stumbled across the same issue. But a feasable workaround is to retrieve both newly inserted records on the "redirect after insert" page using separate recordsets, and send the details from there via SendEmail.

          As the SendEmail trigger will require an insert or update transaction, and as you most probably won´t have anything to insert/update on that "redirect..." page, you might want to read my tutorial "Using a Dummy table: how to outsmart ADDT":

          http://www.guenter-schenk.com/tutorials/tutorial.php?id=2

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: email form data from linked transaction
            Level 1
            Thank you Gunter. You are the best as usual. I only wish you had used the SendEmail transaction in your tutorial instead of image upload.

            When you upload an image you actually do have a transaction to trigger the action, albeit not the one ADDT thinks it is.

            In the case of SendEmail activity on my thanks page, there is no insert or update activity - either actual or fake - to which a trigger can be attached to send the email.

            I'm sure a transaction could be triggered when the page loads, but what is there to attach the "fake" insert or update transaction to the latest record from a query, and then associate that with the sendMail trigger?

            I'm sure the answer will be extremely obvious, but I'm not seeing it.

            Thanks for all your help!!
            • 3. Re: email form data from linked transaction
              Günter Schenk Level 4
              The key to it all is the "update dummy table" approach I´m describing there. If you establish that on the page first, you can attach whatever of those ADDT behaviours which will depend on an insert/update transaction

              -----
              I only wish you had used the SendEmail transaction in your tutorial instead of image upload
              -----

              yeah, and if I change that, there will certainly be another user who´d prefer this getting explained based on an image upload :-)

              -----
              When you upload an image you actually do have a transaction to trigger the action, albeit not the one ADDT thinks it is
              -----

              yes, and it´s the same approach when applying a SendEmail behaviour

              ------
              I'm sure a transaction could be triggered when the page loads
              ------

              you can define this using the "First check variable" option -- let´s say you´re passing an URL parameter to that page, define that parameter for "First check variable".

              ------
              but what is there to attach the "fake" insert or update transaction to the latest record from a query
              ------

              not sure I completely understand this question. That "fake" update transaction will update it´s own predefined stuff and is not related to whatever else you´re about to do on that page -- but your SendEmail trigger depends on this "fake" update transaction to exist, that´s all

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: email form data from linked transaction
                Level 1
                Gunter, I have been passing a URL variable and this has not produced the desired result. It doesn't trigger the sendMail action.

                Rather than asking a question, I thought I'd tell you what I've done and you can tell me where I've gone wrong. Maybe this will help others who might want to split up their data when they insert it but email that data to someone it all at once.

                So there's a page with a form on it. The form submits to two tables through a linked transaction. The linked transaction cannot generate a unified email with the data from both insert transactions.

                So generate the email from the redirect page assigned in the first insert transaction. A thank you page, for instance. The redirect URL will pass a variable, let's say the variable is "1".

                On the thank you page I have a recordset composed of all the data from the most recent row of the 2 tables into which data was inserted by the form on the previous page. Testing this recordset shows that it does grab that row of data and unifies it.

                Because the sendMail action needs a transaction to trigger it, I have put an update transaction on the page that uses a "dummy" table (created according to your instructions from the tutorial you reference above).

                The update transaction is set to look first for a URL variable that equals 1. As the page loads, because this variable is passed in the redirect URL from the form page, this part of the transaction will be satisfied immediately.

                A sendMail trigger is added to the page. It becomes a part of the update transaction. Because the initial part of the transaction is satisfied immediately, the sendMail trigger should also fire immediately, generating the email as the page loads.

                The sendMail action includes the variables from the recordset so the content of the email should be composed of the data from the most recent rows of the two tables into which data was inserted on the form page.

                This is not what is happening, however. The sendMail action is not being triggered.

                Can you see where I have gone wrong?
                • 5. Re: email form data from linked transaction
                  Günter Schenk Level 4
                  I will look into that and report what I can find -- I know it used to work for me this way, but maybe the steps are a little different compared to the image upload process.

                  Can´t do that today, I fear...

                  Cheers,
                  Günter Schenk
                  Adobe Community Expert, Dreamweaver
                  • 6. Re: email form data from linked transaction
                    Günter Schenk Level 4
                    Hi altery,

                    I have just tried it myself using these components:

                    1. the "fake update"
                    2. one recordset for some data to be sent via email
                    3. the SendEmail trigger

                    ...and it works perfectly, the email is getting sent on page load and contains that data from recordset.

                    Your description also looks fine to me, so I don´t know what you could have done wrong -- weird, but the SendEmail procedure as such works with my "fake update" approach, that´s now clear.

                    Cheers,
                    Günter Schenk
                    Adobe Community Expert, Dreamweaver
                    • 7. Re: email form data from linked transaction
                      Level 1
                      Thanks for your help. I'll start from scratch. Good to know the method does work. I very much appreciate the fact that you went out of your way to test it! Long may you live.
                      • 8. Re: email form data from linked transaction
                        Günter Schenk Level 4
                        -----
                        I very much appreciate the fact that you went out of your way to test it!
                        -----

                        I just had to put it on hold, as my website was down for some hours -- but now that I saw it´s up again, it was no big deal testing that

                        ----
                        Long may you live
                        ----

                        Thanks - I hope so, lol :-)

                        Cheers,
                        Günter Schenk
                        Adobe Community Expert, Dreamweaver
                        • 9. Re: email form data from linked transaction
                          Günter Schenk Level 4
                          Hi altery,

                          I have just added the Sample Scenario "send an email on page load" to that "Using a Dummy table" tutorial -- maybe it´s of some help to you

                          Cheers,
                          Günter Schenk
                          Adobe Community Expert, Dreamweaver