5 Replies Latest reply on Jan 19, 2016 11:13 AM by Jamo

    How to send email with the link that has user id?

    pirlo89 Level 1

      Hello everyone, I'm trying to send email with the link that includes user id. After users click on the link they should be able to see the form with their information that has been previously filled. So my question is after I send the email how and what is the best way to pull information and show them to user. Should that be separate page with the cfquery limited on user id or something else? If anyone has any idea what is the best way to do this please let me know. I already have my code that send emails.

        • 1. Re: How to send email with the link that has user id?
          Jamo Level 2

          What is the format of the user id?  Is it a number?  If so, you could use the ColdFusion Hashids CFC to salt+generate a unique ID to use in a URL:

          http://hashids.org/coldfusion/

          You could then attempt to parse the hashIds back into a number and, if possible, allow them to edit the associated record that matches the ID.

           

          Another option would be to generate a random hash and store it in database w/information regarding the update form and user id.  After the link is clicked, log the date so that the link is disabled and can't be used again.

           

          The return page should use SSL and potentially require them to log in (depending upon the sensitivity of the data that will be updated.)

          • 2. Re: How to send email with the link that has user id?
            pirlo89 Level 1

            What is the best way to retrieve information after user click on the link? First step will be to decrypt the ID(yes it is a number) and then pull the information with cfquery or ? I'm trying to think what is the best and most efficient way of doing this. Thank you for help.

            • 3. Re: How to send email with the link that has user id?
              Jamo Level 2

              I'm not sure I understand your question.  What do you mean by the "best and most efficient way"?   What are you specifically requesting assistance on? (Your question is somewhat vague.)

               

              • How to perform a SQL SELECT query using ColdFusion?
              • How to create an HTML-based form and pre-populate it with query data?
              • How to post data from a form back to the server?
              • How to perform a SQL UPDATE query using ColdFusion?
              • 4. Re: How to send email with the link that has user id?
                pirlo89 Level 1

                I already have a form where user enter all information and after they click submit they receive the link. If they click on the link I want to use the same form and populate all fields with user info. 

                • 5. Re: How to send email with the link that has user id?
                  Jamo Level 2

                  Are you saving all of the initially submitted fields to a database?  If so, perform a query and then output the query values to the form field. I don't know what your data (or database) looks like, but a simplified version could look something like this.

                   

                  <CFQUERY NAME="GetForm" DATASOURCE="MyDB">SELECT FirstName

                  FROM SavedFormTable

                  WHERE ID = <cfqueryparam value="#URL.ID#" cfsqltype="CF_SQL_INTEGER"></CFQUERY>

                   

                  <CFOUTPUT QUERY="GetForm">

                  <form action="">

                  <input type="text" name="FirstName" value="#HTMLEditFormat(FirstName)#">

                  <input type="submit">

                  </form>

                  </CFOUTPUT>