Conversion between Person Accounts and Business Accounts

Selling Business to Business was designed mainly for the business to business sales model. Their architecture supports this beautifully. Accounts are companies that you work with. Contacts are the people at those companies that you work with. This design is a huge improvement over contact centric databases like Outlook where you may have the same business noted in your database against several different contacts, but in each case spelled slightly differently (like Snapptraffic, Snapptraffic Consulting,, etc)

This architecture presents a challenge however to the business that sells directly to consumers. There is no need for an Account record in this situation. While that consumer might be associated with a company (where they are employed), the business has no need in most cases to track those details and isn't selling to that person's place of employment. I've seen businesses try to adapt the salesforce account/contact architecture to that business to consumer reality in many different ways, but none of them are all that great.

Selling Business to Consumer - Person Accounts

So decided quite a few years ago to offer a modification to their out-of-the-box architecture that deals with this challenge. It is called Person Accounts. Person Accounts are only available in Enterprise Edition and are only available by request. A support representative will actually have to enable this in your system by making a permanent modification (that's right - once enabled, they can't be disabled).

Person Accounts are really just an Account Record Type. They are a hybrid between accounts and contacts where a contact record is "jammed into" the account. They are tied together, so to speak, so that only one contact exists at the account. The resulting record is both an account with all of it's fields and a contact with all of its fields. When doing a lookup from other objects to a person account, if the object has a lookup to a contact record, then the object can lookup to the Person Account. Likewise, if the lookup is to an account, the object can lookup to the Person Account as well.

This structure now provides a user with the means to say that "Billy Bob Smith" is my client. The fact that Billy Bob works at Acme is irrelevant and no longer needs to be entered.

Working with Both Business and Person Accounts

It is a great solution and works very in almost all situations. Some companies work with both businesses and consumers though. Say, for example, a company that paints buildings. Sometimes they'll be selling to an individual home owner, in which case a Person Account would work best. Other times they'll be selling to a business, like a law office, in which case a Business Account would be used. Salesforce supports this, you just create a Business Account when that is required and a Person Account when that is required.

But what happens if you created a Person Account and later realized that you needed a Business Account? Many times a prospect will contact you and you don't realize until later in the process that you're working with a business.

Conversion Between these Architectures

Due to the fact that these structures are so different between person accounts and salesforce business accounts, salesforce doesn't provide a way to convert between them. They probably could have provided this functionality, but it would have been difficult to deal with custom objects that may be associated with the contact or the account. The lack of this feature has presented problems to many of my clients over the years.

Custom Development To the Rescue

To handle this limitation we normally put a button on the Person Account page layout for "Convert to Business Account" and on the Business Account Layout for "Convert to Person Account". Then these buttons will call visualforce code that does the appropriate conversion.

The conversion process will literally create a new record of the requested type, then re-associate all child objects/records from the originating account type to the new account type. Then finally, the code will delete the originating record.

This conversion has to be custom to handle your specific customizations. For example, maybe you have 3 Business Account Record Types and 2 Person Account Record Types. In a situation like this, you'll need the visualforce page to ask the user which record type they'd like to convert to. Additionally, if there are custom objects, the conversion has to be written with these particular custom objects in mind.

Need Development in Your Salesforce Org?

So if you're dealing with this specific issue in your salesforce org, or any development issue, and would like to speak to someone here at Snapptraffic Consulting about the development of this system for you, based on your unique customizations, please feel free to contact us. You can reach us through our website at Visualforce Reports

Custom Reports have come a long way in over the years. With the recent addition of report buckets and the ability to do joins between reports, the built in functionality is better than ever.

But with that said - there are still some significant limitations in the Salesforce Custom Report system that need more individualized solutions. The custom reporting system in salesforce is meant to be "universal", meaning, it is designed to meet the various needs of millions of different users. But frequently, a company needs a reporting system designed around their exact process or data model.

Custom Reporting Done in Visualforce

To meet the needs of these clients we usually resort to Visualforce, a system within that allows us to run custom code, written in apex, in the cloud. Visualforce gives us the ability to build "custom user interfaces".

An Example Visualforce Custom Report

Since a report is just a presentation of data. Visualforce gives us all the power to produce the exact custom report that a client might need. When building a custom visualforce based report, we write our code to go get the data needed, assemble it properly, and display it in whatever format is most useful to the end user.

Visualforce Reports
A Custom Report built in Visualforce

See the above example. In that report the client needed to assemble and display data in a way that could not be handled by the standard salesforce reporting system. Here we were able to summarize it as needed, group the dates as needed, compare "Retained" vs "Not Retained", calculate a percentage, and color code the results to make the data easy for the reader to interpret.

Be sure to note: this is entirely custom! I'm not showing you a canned product that we sell or some third party reporting solution. The client, along with a Snapptraffic consultant, discussed the business problem, identified that data upon which a report was needed, discussed the output desired, and our developers wrote the apex code needed to produce the above output.

Drill Downs

Also notice the "Drill Downs" - if you look closely (I know, the image is small), you'll see that many of the numbers in the report are links. Those links open a report that provide the reader with the exact data that makes up the numbers in each cell. The next image is one of those drill downs:

Drill Down on the Exact Data Needed

Here you can see the opportunities that make up one of the numbers in the table above.

Export to Excel

If you look closely at the above image, you'll also see an "Export to Excel" button. This was added at the customer's request and pushes the data in the drill down to an excel file so that they can do further analysis on their own.

Have it your way!

The beauty of using Visualforce to build these reports is that there are so few limitations. Want to email the results? No problem. Push data to excel? You can have it. Compare data from completely independent objects in Salesforce? Easy. Seriously, you can have it your way.

Edit Underlying Data?

How about this interesting use case -  The client wanted to be able to report on progress towards calling goals (they did webinars, look for that word in the example). We created a custom object into which the webinar call goals could be stored. The report became an interface where users could view their progress toward the goal - along with appropriate color coding - and an area where managers could input the goals (only users with appropriate permissions set could edit the goals).

So not only was this a report, it was a goal management system - both reporting on and allowing management of the company webinar calling effort.

Charts? also comes with a powerful dashboarding system, allowing the user to easily create charts in order to display graphically the data contained in an underlying report. It stands to reason though, that if the underlying reporting system has limitations, then so too will the dashboard charts. We get around this using Google Visualizer.

Google has provided a powerful system into which we can feed data, pass certain parameters, and receive back from google the chart requested. Here is an example of that:

Google Visualizer Charts Rendered in Visualforce

Notice the "switches" we provided the user at the top. They can select their regions, display method, and pick their desired date range. Entirely custom, built to meet their needs.

So if you find that your reporting needs go beyond what the Reporting Engine can provide, then reach out to us at

We'd be happy to meet with you, discuss the reports that you need, give you an estimate for having them built, and get them made for you in a timely manner.

Salesforce Scheduled Batch Apex

Scheduled Apex is a super useful system in that permits a developer to write some batch apex code and execute that code at scheduled times. This is incredibly useful because salesforce triggers and workflow rules can only execute as the related record is saved. A salesforce Time Based Workflow rule can fire based on hours or days from some date or time on the record, but its functional capabilities are fairly limited (create tasks, send an email to a limited set of recipients, update a field on the associated record). 

Sometimes you need to take action at some point that is completely independent of the record being saved. A "Scheduled Apex Batch" can solve this problem.

Here is an example: A response is required by a support rep at a given date/time for a case submitted by a client. The "Response Required By" is a time previously calculated, but can't be used by the standard SLA system in SF. Therefore, we need a way to look at all the open cases every few minutes and send notification to the case owner if the Response Required By is about to expire. 

You may also be wondering: "how frequently can I schedule an apex batch to run in" 

A scheduled apex can be scheduled to run at most once every one hour. 

Big HOWEVER; but you can have 12 schedules for the same Apex Class to run every hour. So you can schedule it to execute at the 0 minute of the hour, 5th minute of the hour, ….., 55th minute of the hour. So effectively, the most frequent execution of a given class is "every five minutes".

However there are other limitations that need to be noted:
- Salesforce only adds the process to the queue at the scheduled time. Actual execution may be delayed based on service availability – So, the interval between two subsequent email notifications may be less than 5 minutes.
- You can only have 25 classes scheduled at one time – You will be left with only 13 schedules for other requirements

You may also want to consider the limits on the no. of emails that can be sent per day.

Other Scheduled Batch Apex Application Examples:

- Check all your open opportunities once a day and remind users to update those past their close date
- Find all the open opportunities where there is not an open task for followup and create that task
- Send an email to clients automatically with open balance statements
- Send an email reminder to all clients with whom you have an appointment the following day
- Send an email reminder to all your traveling sales reps every day with a reminder of their upcoming appointments (or send a reminder to them after their appointments to update the opportunity with the results of their meeting with the client)
- Data cleanup: run a batch each day to look for and notify owners of duplicates
- oh, about a thousand others - you can take pretty much any operation you care to on your data stored in salesforce and create other records, make notifications, create tasks, kick off integrations - you name it. 

If you have an idea for a project like this and want to get it developed for your organization, we can help! Our developers produce systems like this every day. Contact us if you'd like to discuss your project, get an estimate, and get it produced. You can reach us at