New to VisualForce and Apex and could do with some help please. I've created a VisualForce page and extension class that allows a public sites user to complete a form (accessed via URL that is sent by email to them) and save it, which then updates fields in a custom object. I want to allow them to do this only once - so if they were to click on the link in the email again they would get some sort of message saying "you can no longer access this form". Can someone please help with the best way to do this? Thanks.

  • 1
    How do you uniquely identify an user? Do you generate an unique URL for each user? If so, can you not store that URL parameter in the custom object and not allow another record that has the same value? – joe May 24 '16 at 10:43
  • Yep URL sent with id= custom object record id as per response below. How would I go about this? Thanks – livosl May 24 '16 at 12:36

As in your case the URL will be sent to user via e-mail, you can use the email id to stop multiple submit.

Your email link should look like this http://<application-url>?email=abc@xyz.com. You can get the email parameter and store the form data against this email id. So next time when the user submits again you can check and notify the user.

|improve this answer|||||
  • The URL ends with "id=" then the custom object record id - not an email address. Would that still work? If so can you let me know how to go about this? Thanks – livosl May 24 '16 at 12:33
  • If this id is unique for each user it will work. – Saroj Bera May 24 '16 at 12:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.