Quick Notes on FSC Households
Householding in Financial Services Cloud allows you to group related Members and Entities together to calculate Household summaries and visualize relationships. From a developer’s perspective you’ll need to become familiar with two tables:
AccountContactRelation
FinServ__AccountAccountRelation.
AccountContactRelation may be something you’re already familiar with. It’s part of the core Salesforce platform and allows you to associate multiple Contacts with a single Account. In FSC it is used to associate Person Accounts with a Household. The AccountId represents the Id of the Household record and the ContactId is the Id for the Contact portion of the Person Account.
FinServAccountAccountRelation is a table that is part of the FSC managed package. There are several custom fields on this object but the three critical ones are the following:
FinServ__Account__c - This relates to the Household record.
FinServ__RelatedAccount__c - This relates to a non person account eg. A business record
FinServRole__c - This is a lookup to a FinServ__ReciprocalRole__c and it’s required. Even if all your not defining roles you need to create at least one of these records and populate it as a lookup on the AAR.
Now there are some handy things you should know as a developer to be successful with these tables:
Given a member how do I get a list of all the other members in a given household?
public static List getMembersForHousehold(Id householdId){
List contactIds = new List();
//collect contactIds (persons) from ACRs
for(AccountContactRelation acr : [SELECT ContactId FROM AccountContactRelation
WHERE AccountId = :householdId
AND Account.RecordTypeId =: myAccountHousholedRecordId])
//collect accountId from contact
List accountIds = new List();
for(Contact con : [SELECT AccountId FROM Contact WHERE Id IN :contactIds])
List accounts = [SELECT Id,Name FROM Account WHERE Id IN: accountIds];
}
This snippet is best stored in a utility class. It can easily be extended to accept a FieldSet Name as a parameter so you can query a diverse set of fields for the final SELECT clause depending on the implementation.
How do I quickly get some number on Household size?
This SOQL query will return the Household Id and the number of Members for each household
SELECT count(ContactId), AccountId FROM AccountContactRelation GROUP BY AccountId ORDER BY count(contactId) DESC LIMIT 5