Feeling adventurous. I would like to try to create my first Visualforce form and embed it into a Squarespace webpage.

Can anybody guide me?

Business requirements: - A single form has to capture a 'parent' contact AND a 'child' contact. (basically a household). Each has its own record type.

  • The 'parent' is the primary contact and there are just a few fields need to be captured (email, address)

  • There is at least one 'child' record but there are often 2+

  • Each 'child' record captures two custom contact fields: 'current grade' and 'current school'

  • 'Current School' is a lookup coming from custom objects: schools and school districts

  • Problem: To find their 'current school', the address:state field has to load/find/generate? a dropdown list of all 'school districts' in that state (this list is already in the School District object)

  • Once the 'school districts' are isolated to only the contact's designated state, the 'school name' field has to load/find/generate? a dropdown list of all 'school names' in that school district (this has been created and is available in the Schools object)

  • When the event "submit" is created, the new contact goes into a holding area for an admin to run a de-dup to make sure the contact is not already in Salesforce

  • 1
    You've got a lot of separate questions here, @Jorey. Shane has given you a good pointer on how to surface this page as part of a Site. That's one question. I think if you spend some time with Trailhead and build some simple VF pages, you'll quickly see that inserting your two records is not per se too complex, and as you refine it you might want to ask more specific questions here.
    – David Reed
    Sep 29 '18 at 22:44
  • Your School and District selection interfaces are going to involve some partial page rerenders and generating a List<SelectOption> in your controller based on user input. If you search some of those terms, again, you'll find some more resources you can use to refine your project.
    – David Reed
    Sep 29 '18 at 22:46
  • Lastly, deduplication is (can be) a big and complex area and I think you'll need to do some more detailed specification on your desired behaviors before implementing that.
    – David Reed
    Sep 29 '18 at 22:46

Sounds like a good project! The first issue you need to address is user authentication. I imagine the idea is to allow non-Salesforce users (or, at least, non-authenticated users) to fill out the form.

With Visualforce, the only way I see to do this is by hosting the page on a public Salesforce Site and then using an iFrame on your SquareSpace page to load it in.

If you're feeling extra-adventurous, you could try creating a Lightning application and running it using the Lightning Out library. It supports non-authenticated users via the ltng:allowGuestAccess interface

Good luck!

  • Hi Shane, yes. I have created a public Salesforce site and was thinking about using iFrame. Are you aware of a knowledge base article, a video or some sort of tutorial to help me to create the form since it consists of two contact record types?
    – Jorey
    Sep 29 '18 at 18:32
  • Hey Jorey. I think I see where you're coming from now -- were you thinking about using the standard Contact controller for your Visualforce page, like this? trailhead.salesforce.com/en/modules/visualforce_fundamentals/… I'm afraid that won't work in this case. You'll need to use a custom controller instead. Let me know if that's what you were thinking. There might be an easier way to approach this. Sep 29 '18 at 23:00
  • Hi Shane! Thank you for posting! Yes, you are correct, it seems like the standard controller won't work. Are you able to guide me?
    – Jorey
    Oct 4 '18 at 17:15
  • I would start with just your first and last bullet-points: Create a visualforce page and controller that handle creating a primary contact record, saving it, and putting it "on hold" until an admin can confirm it isn't a duplicate. There are a few ways of handling the "on hold" part. I would go with saving the record and then using Apex to fire an approval process for it. I'll post some links below that should help put you in very good shape to get that far. Oct 4 '18 at 23:57
  • Creating and using Custom Controllers: trailhead.salesforce.com/en/modules/visualforce_fundamentals/… Oct 4 '18 at 23:57

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