The backstory:
The org I am working in allows Person (consumer) and Business records to be created by users and a host data push process in Account. As a result, today we have a large number of each type in Account.
As is expected, after a period of a couple years, many of both have opportunities, cases, and activities attached to the Account records.
Now the fun part:
Folks have their heart set on using Parent Account to group customers together into larger hierarchical relationships. This feature is being sold as a solution for decommissioning another application that was built outside of Salesforce years ago that performs basically the same function.
However, as of the Winter 2013 release it is not technically feasible to choose a Parent Account for a Person (consumer) Account record.
The research I have done tells me it is easy enough to reload the customers who are today consumer as business.
However, is it technically feasible to:
- Maintain the same URLs and IDs for the consumer records in Account
- Keep all dependent items (opportunities, activities, etc.) linked
- Maintain the same URLs and IDs for all dependent items
- Do the above at scale (more than 300,000 Account records)
- Get it all done in one night
Essentially the question is can I easily update the record type in Account and change the Person Accounts to Business Accounts.
Today the main motivation for wanting to do this is as follows. It would allow the org to:
-
Designate a Parent Account for consumer records
-
Group consumer customers with business customers into a hierarchical relationship
Here is an example of a very simple hierarchical relationship with a mix of business and consumer:
ABC Company
– Mr. ABC
– Mrs. ABC
Thank you experts in advance for your insights.
Best Answer
As far as I know it's not possible to meet all your requirements. Specifically the one about keeping the same Id / URL. I'd love to be proved wrong :)
You'll have to insert a new Account with right record type and link/reparent all related data, then eventually delete the old PA. Maybe you could defer the delete and create a new field "click here to go to the new record"...
We can't use
merge
statement on a mix of business and person accounts.The actual process is not too complex. I'll be describing it as for one record, it's up to you to maybe make a batch job out of it, maybe create a button to convert one at a time.
Things to consider beforehand:
Person...
or...__pc
in them (I think easiest would be to download them all to Eclipse IDE and run a full search - Ctrl+H). You might have to recreate them for business-only version, you might be up for some explanations if data suddenly "disappears" from certain dashboards.ConvertedAccountId
on the lead will point to old record (and I think converted lead becomes readonly afterwards).&& $Profile.Name != 'System Administrator'
so they won't fire and cause problems.Create a new Account
Prepare a query that fetches most of the standard and
__c
Account fields. We could try writing a dynamic way of fetching all the fields that match the condition but I think it's better to be done by hand (you'll want to skip the SystemModStamp, isDeleted, RecordTypeId, maybe you use Jigsaw / Data.com...). And clone it.Copy the Contact
This should be straightforward enough as there can be only one under the PA.
Fix all references
First we need to learn how many objects have a lookup to Account before we can fix them. You could have a look at the "child relationships" in Eclipse or Real Force Explorer:
Or you could use code to fetch them all:
Some won't be applicable (Acc Contact Roles for example). Some stuff you'll have to write-off like history entries. Most will be easy to just fetch all and update the AccountId. Those that can't be reparented - could be queried, deep cloned and inserted back with new Account Id.
Cleanup
Check sharing rules? Check the manual sharing entries (if any). Remove the hacks from validation rules if you've made the exceptions for sysadmins. And once it looks good - delete the original Person Accounts.