When you activate the CRM enrichment capability of the Salesforce integration, HG Insights populates three objects in your Salesforce org:
HG Technographic
HG Firmographic
HG IT Spend
These objects are linked to your Account and Lead records via lookup fields.
By default, this data lives on the HG objects and is displayed through Visualforce components. But you’ll often want to surface key data points directly on the Account or Lead record itself - for example, a checkbox showing whether an account uses a specific product, or a field showing total IT spend.
This guide walks through the most common patterns, starting with no-code (Flow) approaches and including Apex alternatives for teams that need more control.
Before You Start
Confirm your HG package version (CRM enrichemt).
Go to Setup > Installed Packages and find “HG Insights.” Some fields (like Global HQ firmographics) require package version 1.10+.
Verify HG fields exist on your Account/Lead objects. The HG package adds four fields to both Account and Lead that manage matching and enrichment. You should see these fields on your records:
Field Label | API Name | Type | Purpose |
|---|---|---|---|
HG Id |
| Text(255) | Links the record to HG’s company database |
HG Match Status |
| Text(100), External ID | Shows whether HG has matched this record (e.g., “Matched”) |
HG Matched Date |
| Date | When HG matched this record |
HG Enrich Status |
| Picklist | Controls whether HG enriches this record with data |
If these fields aren’t populated, your HG integration may not be set up yet. The custom fields you build below depend on HG data being matched and flowing into your org.
Identify your use case from the table below so you can jump to the right section.
# | Use Case | Example | Recommended Approach |
|---|---|---|---|
1 | Checkbox - does this account/lead have a specific product? | “Uses Salesforce” = true | Flow (simplest) |
2 | Rollup list - show all installed products as a text list | “Installed Products” = “Salesforce; SAP; Oracle” | Flow or Apex |
3 | Count - how many products are installed? | “Product Install Count” = 12 | Flow (rollup) |
4 | Spend amount - surface IT spend on the parent record | “Total IT Spend” = $2,400,000 | Flow or Formula |
5 | Formula field - reference HG data from related records | Show employee range from Firmographic | Formula |
Choose your approach: Flow or Apex? Each use case below includes both a Flow (no-code) approach and an Apex (code) approach.
Flow (No Code) | Apex (Code) | |
|---|---|---|
Best for | Most orgs. Admins can build and maintain these without developer help. |
|
Who can do it | Any Salesforce Admin | Requires a Salesforce Developer or Admin with Apex experience. |
Where it lives | Built visually in Setup > Flows | Written as Apex Classes in Setup > Developer Console (or deployed via VS Code with Salesforce Extensions) |
Limitations | Can hit collection limits on accounts with hundreds of product installs. Scheduled Flows help avoid this. | Requires deployment to production via a change set or CI/CD pipeline, and needs test classes for code coverage. |
Step 1: Create Your Custom Field on Account or Lead
No matter which use case you’re building, you first need a custom field on the target object.
In Salesforce, go to Setup > Object Manager > Account (or Lead).
Click Fields & Relationships > New.
Choose the field type based on your use case:
Use Case | Field Type | Example Field Label | Example API Name |
|---|---|---|---|
Checkbox | Checkbox | Uses Salesforce |
|
Rollup list | Text Area (Long) | Installed Products |
|
Count | Number | Product Install Count |
|
Spend amount | Currency | Total IT Spend |
|
Set field-level security so the right profiles can see it.
Add the field to your page layout.
Use Case 1: Checkbox - “Does This Account Use [Product]?”
Goal: A checkbox on the Account (or Lead) that is true when a specific product appears in the account’s HG Technographic records.
Flow Approach (No Code)
Create a Record-Triggered Flow:
In Salesforce, go to Setup > Flows > New Flow > Record-Triggered Flow.
Configure the trigger:
Object:
HG Technographic(HG_Insights__HGTechnographic__c)Trigger: A record is created or updated
Entry Conditions:
HG_Insights__Product__cEqualsSalesforce(or your target product)
Add an Update Records element:
Record: The Account related to this technographic record
How to Find: Use
{!$Record.HG_Insights__Account__c}to get the Account IDField:
Uses_Salesforce__c=true
Save and activate.
Handle deletions (unchecking when product is removed):
Create a second Record-Triggered Flow on
HG Technographic, triggered on delete.Add a Get Records element to check if any other technographic records still exist for that product on the same Account.
If no records remain, update the Account checkbox to
false.
For Lead records: Duplicate the Flow, but reference HG_Insights__Lead__c instead of HG_Insights__Account__c.
Apex Approach (Advanced)
Use a batch class if you have a large volume of records or want to set checkboxes for multiple products at once.
public class PopulateProductCheckboxesBatch implements Database.Batchable<SObject> {
public Database.QueryLocator start(Database.BatchableContext bc) {
return Database.getQueryLocator([
SELECT Id, Uses_Salesforce__c, Uses_AWS__c
FROM Account
WHERE Id IN (
SELECT HG_Insights__Account__c
FROM HG_Insights__HGTechnographic__c
)
]);
}
public void execute(Database.BatchableContext bc, List<Account> accounts) {
Set<Id> accountIds = new Set<Id>();
for (Account a : accounts) {
accountIds.add(a.Id);
}
// Get all technographic records for these accounts
Map<Id, Set<String>> accountProducts = new Map<Id, Set<String>>();
for (HG_Insights__HGTechnographic__c tech : [
SELECT HG_Insights__Account__c, HG_Insights__Product__c
FROM HG_Insights__HGTechnographic__c
WHERE HG_Insights__Account__c IN :accountIds
]) {
if (!accountProducts.containsKey(tech.HG_Insights__Account__c)) {
accountProducts.put(tech.HG_Insights__Account__c, new Set<String>());
}
accountProducts.get(tech.HG_Insights__Account__c).add(tech.HG_Insights__Product__c);
}
// Set checkboxes
for (Account a : accounts) {
Set<String> products = accountProducts.get(a.Id);
a.Uses_Salesforce__c = (products != null && products.contains('Salesforce'));
a.Uses_AWS__c = (products != null && products.contains('Amazon Web Services'));
}
update accounts;
}
public void finish(Database.BatchableContext bc) {}
}To run manually: Open Developer Console > Debug > Open Execute Anonymous Window (Cmd+E / Ctrl+E), then run:
Database.executeBatch(new PopulateProductCheckboxesBatch(), 200);To schedule (recommended):
// Run daily at 2 AM
String cronExp = '0 0 2 * * ?';
System.schedule('HG Product Checkboxes', cronExp, new PopulateProductCheckboxesBatchScheduler());Use Case 2: Rollup List - All Installed Products as Text
Goal: A text field on Account showing all installed products separated by semicolons. Example: Salesforce; SAP SD; Amazon Web Services; Slack
Flow Approach (No Code)
Salesforce Flows don’t natively concatenate child records into a single text field. You have two options:
Option A: Use a Flow with a Loop
Create a Record-Triggered Flow on
Account(or a Scheduled Flow that runs nightly).Add a Get Records element to retrieve all
HG Technographicrecords whereHG_Insights__Account__c= the Account ID.Add a Loop element over those records.
Inside the loop, use an Assignment element to append
{!LoopVariable.HG_Insights__Product__c} ;to a text variable.After the loop, use an Update Records element to set
Installed_Products__cto the concatenated text variable.
Option B: Use a Scheduled Flow (recommended for large data volumes)
Same logic as Option A, but triggered on a schedule (e.g., nightly) rather than on record changes. This avoids hitting Flow limits during large data loads.
Apex Approach (Advanced)
public class PopulateInstalledProductsBatch implements Database.Batchable<SObject> {
public Database.QueryLocator start(Database.BatchableContext bc) {
return Database.getQueryLocator([
SELECT Id, Installed_Products__c
FROM Account
WHERE Id IN (
SELECT HG_Insights__Account__c
FROM HG_Insights__HGTechnographic__c
)
]);
}
public void execute(Database.BatchableContext bc, List<Account> accounts) {
Set<Id> accountIds = new Set<Id>();
for (Account a : accounts) {
accountIds.add(a.Id);
}
Map<Id, List<String>> accountProducts = new Map<Id, List<String>>();
for (HG_Insights__HGTechnographic__c tech : [
SELECT HG_Insights__Account__c, HG_Insights__Product__c
FROM HG_Insights__HGTechnographic__c
WHERE HG_Insights__Account__c IN :accountIds
ORDER BY HG_Insights__Product__c ASC
]) {
if (!accountProducts.containsKey(tech.HG_Insights__Account__c)) {
accountProducts.put(tech.HG_Insights__Account__c, new List<String>());
}
accountProducts.get(tech.HG_Insights__Account__c).add(tech.HG_Insights__Product__c);
}
for (Account a : accounts) {
List<String> products = accountProducts.get(a.Id);
a.Installed_Products__c = (products != null) ? String.join(products, '; ') : '';
}
update accounts;
}
public void finish(Database.BatchableContext bc) {}
}Use Case 3: Count of Installed Products
Goal: A number field showing how many products are installed for an account.
Flow Approach (No Code)
Create a Record-Triggered Flow on
HG Technographic, triggered on create and delete.Add a Get Records element to retrieve all
HG Technographicrecords for the same Account.Use the Count of the Get Records result.
Update Records: Set
Product_Install_Count__con the Account to the count value.
Alternative: Roll-Up Summary (if using Master-Detail)
If your org has converted the Account lookup to a Master-Detail relationship (not default), you can use a native Roll-Up Summary field instead of a Flow.
Use Case 4: Surface IT Spend on Account
Goal: Show total IT spend directly on the Account record.
Flow Approach (No Code)
Create a Record-Triggered Flow on
HG IT Spend, triggered on create, update, and delete.Add a Get Records element: all
HG IT Spendrecords whereHG_Insights__Account__c= the related Account.Add a Loop with an Assignment to sum
HG_Insights__Spend_Category_Amount__c.Update Records: Set
Total_IT_Spend__con the Account to the sum.
For a specific spend category only, add a filter condition: - HG_Insights__SpendDetailSpendCatName__cEquals Application Software (or your target category)
Use Case 5: Formula Fields
Formula fields are the simplest option when you only need data from the first related HG record (e.g., one Firmographic record per Account).
Example: Show employee range from Firmographic on Account
This only works if each Account has a single Firmographic record. Formula fields cannot aggregate across multiple child records.
For this pattern, it’s simpler to use a Flow that copies the value: 1. Record-Triggered Flow on HG Firmographic, triggered on create/update. 2. Update Records: Set HG_Employee_Range__c on the Account to {!$Record.HG_Insights__EmployeesRange__c}.
Tips and Gotchas
Long Text Area limits: If you’re building a rollup list (Use Case 2), use a Long Text Area field. Standard Text fields max out at 255 characters, which many accounts will exceed.
HG data refreshes: HG data updates nightly. If you use Flows triggered on record changes, your custom fields will stay in sync automatically. If you use scheduled Flows or Apex batches, they only update on their schedule.
Testing: After building your Flow or deploying Apex, pick a few Accounts you know have HG data and verify the fields populate correctly. Check the HG Visualforce component on the Account to cross-reference.
Running Apex batches manually: Developer Console > Debug > Open Execute Anonymous Window, then:
Database.executeBatch(new YourBatchClassName(), 200);