function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sundsund 

Lead to "Account" scenario

We allow customers to self-register for classes.  A registration requires collecting about 50 data points, which map to Account, Contact and Opportunity objects. Often we already have a Lead or Account instance created for the individual submitting the application, but sometimes we don't.

 

My question:  What's the best way to handle the capture of application web form data in SFDC?  One obvious way is to use the built-in Web to Lead capability.  But since we already have an Account with an email address, so conceptually a second approach could be to simply find the associated Account instance and update Account Contact fields, and create a new related Opportunity instance.  But is this approach a) reasonably doable in Apex and b) any better than creating a new new and then "converting" it?

 

Any other approaches / best practices we could consider for scenarios like this?

 

Dovid BDovid B

It sort of depends on your needs. To use web-2-lead is slower to actually insert the record than VF and apex. Also it would require a manual conversion unless you use a trigger. On the other hand, if there is a reason to qualify new students before allowing them to register, then leads is a good idea.

 

yes, you should be able to do the 2nd option via VF and apex. In the controller, you can make a soql query on the email address and if it finds it, update that contact and create opportunity. If not then create new account and contact or maybe for new students you want to put them in leads until you have qualified them.