0

For practice, my project is to automate data entry for a company thats new to Salesforce. Currently, they gather user information manually and then enter that info into excel.

I need help to build a form using Apex Triggers to help in this process. For simplicity, I only need the first and last name of the user and a submit button at the end. Once the submit button is clicked, a trigger processes the information in Salesforce. (This automatically assumes the user is a new user and is treated as such).

Another requirement is this form needs to be accessible publicly for the sake of outreach. I would like to know if this is possible and websites that allow this?

The reason for this project is to see how it fairs in comparison to Web to Lead and Email to Lead.

2 Answers 2

1

you could try https://trailhead.salesforce.com/en to learn about salesforce.

you can create sites for external forms (https://developer.salesforce.com/page/Sites).

1

This question is quite broad in scope, and there are some misconceptions that you have that should be cleared up before you attempt to start this project of yours.

A trigger doesn't directly act as the back-end to a form. Visualforce follows the MVC (Model - View - Controller) paradigm, and Lightning follows the relatively new WebComponents paradigm (but each component still looks/feels an awful lot like MVC).

In both cases, the code that works on data from a form is in a 'Controller', rather than a trigger. To make things grossly simplified, a 'Controller' is where you put the logic that defines the actions that you want to perform through a given page (things like canceling, saving, searching, and processing user input). Controllers power the interactivity of a page. A 'Trigger', on the other hand, is non-interactive and operates on records that are being inserted, updated, or deleted from the database system(s) that underpin Salesforce.

With what you've described so far, there wouldn't be any trigger involved. Your form would gather input and start building a new User record. Your controller would be used to insert that record into Salesforce when you click 'submit'. If your purpose here is to learn about triggers, I'd recommend finding a different project.

As far as making the form publicly available goes, you could accomplish that using Force.com Sites or Lightning Out.

If you're just getting started with customizing salesforce, you should go to http://trailhead.salesforce.com/en . Trailhead's content and format is much better suited for learning the basics than this site is.

As a final note, if this is more than just an exercise, and you're looking to have real people use it as part of their work routine, I'd strongly recommend not re-inventing the wheel, and make use of the standard Web-to-Lead functionality provided by Salesforce. If you find no issues with Web-to-Lead, and can stay under the 500 lead per day limit, it's a lot easier/faster to simply use standard features/functionality. Plus, if you have a recaptcha api key, web-to-lead takes care of basic spam filtering (which has pretty much been required on web forms for over a decade at this point. You/your users will be sad if you don't include spam filtering).

Not the answer you're looking for? Browse other questions tagged .