Manually Creating a Trigger to Update a Custom Firmographic Field

Last updated: December 5, 2025

This article covers the case where you want to take data from an HG Firmographic field, and populate your own custom field on the Account object.

For this to work, you'll create a trigger for each field you want to populate.

 

In the sample code below, we take data from HG_Insights__RevenueRange__c and populate it in a custom field called RevenueRange__c

 

trigger HGFirmographicTrigger on HG_Insights__HGFirmographic__c (after insert, before delete) {
Account acc;
List accList = new List();
if (trigger.isAfter && trigger.isInsert) {
for (HG_Insights__HGFirmographic__c hgTech : trigger.new) {
acc = new Account(Id = hgTech.HG_Insights__Account__c);
acc.RevenueRange__c = hgTech.HG_Insights__RevenueRange__c;
accList.add(acc);
}
if (accList.size() > 0) {
update accList;
}
}
if (trigger.isBefore && trigger.isDelete) {
Account acc;
List accList = new List();
for (HG_Insights__HGFirmographic__c hgTech : trigger.old) {
acc = new Account(Id = hgTech.HG_Insights__Account__c);
acc.RevenueRange__c = '';
accList.add(acc);
}
if (accList.size() > 0) {
update accList;
}
}
}