Monday, April 4, 2016

The Sobject Crusade: Account

Back to the Sobject Crusade list.

Source: Account

Account object is the very first object you'll see on the CRM, mostly because it is the first standard object tab you are presented when you open up a new Developer ORG:


The Account object represents an organization or a person that is involved in your business and that related with the other objects of your CRM.

Account could be a partner, competitor or simply a customer.


Account could also be an individual, and this leads to Person Account: they are a special kind of Accounts because they are strictly related to an underlying Contact object, and so are not identified anymore by a simple Name but by FirstName and LastName.
Person Accounts can be placed both on Account and Contact lookups (that's because they are a composition of 2 different objects).
To activate the Person Account feature, you have to ask to the Salesforce support.

Account object have a lot standard fields (2 set of addresses, contact fields, business fields such as TicketSymbol or YearStarted).
If we have the Person Account feature enabled and if the Account is created as or converted to a Person Account, it will acquire a set a Contact's fields such as FirstName, LastName, Suffic, MiddleName and other fields with a suffix of Person (e.g. PersonBirthDate, PersonTitle but also 2 other sets of addresses, like PersonOtherAddress and PersonMailingAddress).

Reading the docs of Account's fields, I came across to a strange behavior of the PersonBirthDate field in queries: The year portion of the PersonBirthDate field is ignored in filter criteria, including report filters, list view filters, and SOQL queries. That is to say that this query:

SELECT FirstName, LastName, PersonBirthDate FROM Account WHERE Birthdate > TODAY

will query for all Accounts which birthday comes after TODAY (disregarding the year).

Accounts can be created directly via CRM, API or by converting Leads.

Accounts are also related to customer portal or Community users: every user in your communities will have a related Contact object which will be related itself to an Account record (which can "parent" more than one User/Contact). A Person Account will thus be User's Contact and Account as well.

Account is also strictly related to Opportunity, Contact, Case, Contact objects.