+ Start a Discussion
DorababuDorababu 

differentiate person account and business account with auto number

Hi,

I am using person account. I am trying to differentiate person account and business account by using auto number, Person account will have auto number as APP-0001 and business account will have BA-0001.

Can anyone give a good solution for this in the form of a trigger or any other solution is greatly appreciated.

Best Answer chosen by Admin (Salesforce Developers) 
Jerun JoseJerun Jose
You could do this by using two autonumber fields and a formula field. The first autonumber 'PersonAccNum' will be setup to display APP-0001 format and the second autonumber 'BusinessAccNum' will be setup to display BA-0001 format. Then you can create a formula field 'Account Number' which will display the appropriate value depending on whether the account is a person account or not.

All Answers

Santosh KumbarSantosh Kumbar
Do you want add auto number when Person account and business account inserted ? Or Just differentiate the existing Accounts using Autonumber
DorababuDorababu
I want to add auto number when Person account and business account inserted (trigger before insert)
Jerun JoseJerun Jose
You could do this by using two autonumber fields and a formula field. The first autonumber 'PersonAccNum' will be setup to display APP-0001 format and the second autonumber 'BusinessAccNum' will be setup to display BA-0001 format. Then you can create a formula field 'Account Number' which will display the appropriate value depending on whether the account is a person account or not.
This was selected as the best answer
Santosh KumbarSantosh Kumbar
I dont think so Auto number can be calculated through trigger.

The other option could be create a formula field which does concatenate
Your defined String(Check Is person account have string as PA or BA ) +
your record autonumber