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
wintamutewintamute 

Error when converting person accounts to "normal" accounts

When trying to change the recordtype of a person account to normal business account, I get the following error: "insufficient access rights on cross-reference id".

 

However, it works fine when I change it to a different person account record type. According to the documentation, it should also work across recordtype families.

I do have access to the recordtype I want to change to in the profile settings and can create a account with that recordtype manually in the GUI and with apex, so it's not an actual access rights issue as the error message suggests.

 

Any ideas what could be the problem here?

 

Thanks

the0nly0nethe0nly0ne

From my understanding, person accounts cannot be converted into business accounts. The Apex Guide states that "Apex cannot be used to change standard functionality—Apex can only prevent the functionality from happening, or add additional functionality".

 

To work around this, I would suggest configuring your Apex to gather all the details from the person account, using it to create a new business account, then delete the person account. The down side to this is that the Created Date will not maintain its original value, and that you will also need to account for the related records (activity history, etc.) when coding the Apex, as the record Id of the account will change. I am fairly new to Apex development, but I am pretty certain this can be done.

 

I hope this helps.

mwengleinmwenglein

The documentation says it should work:

 

"You can change the record type of an account across record type families (typically performed when migrating business accounts to person accounts, but the reverse operation is also supported). When you change the record type from a business account to a person account, the person contact is created. When you change the record type from a person account to a business account, the person fields are set to null, and the person contact becomes a regular contact with the same parent account it had before the change."

 

Any ideas by the team who wrote this? Thanks :-)