Optimized Attribution Rebuild for Custom Models
In 2023, we enabled our attribution system to skip rebuilds of closed opportunities in order to optimize the rebuild timeframe. This requires models to keep track of when they were modified, as well as a means for them to report this information to the attribution infrastructure. This enhanced functionality only works by default for standard models (Account-Based or Opportunity-Based). For customers with custom models, you will need to make the following changes to your custom model to take advantage of this feature.
Implement the ISupportIncrementalRebuild interface
This interface needs to be implemented on your main model class, i.e. the one that implements ICampaignAttributionConfiguration. Your new class declaration may look something like this:
public inherited sharing class YourModelConfiguration implements FCI_CampaignInfluenceAPI.ICampaignAttributionConfiguration, FCI_CampaignInfluenceAPI.ICampaignAttributionWeightingInfo, FCI_CampaignInfluenceAPI.ISupportIncrementalRebuild
Note: that the class names will have the prefix FCRM. or FCCI. depending on which attribution package you are using.
The interface defines two methods:
DateTime GetLastConfigurationChangeDate();
Object GetModelInfo(String infoType);
- The GetModelInfo method is not currently used and should return null.
- The GetLastConfigurationChangeDate function should return the time of the last configuration change.
You may choose to implement the "GetLastConfigurationChangeDate" function however you wish. We recommend to add a new LastConfigurationSaveDate__c datetime field to the model’s custom setting, and update it any time the model configuration is saved. This is how we implemented for our standard models.
For example: In the model configuration class, we implemented the two methods as follows:
public DateTime GetLastConfigurationChangeDate() {
return ModelConfigSupport.GetLastConfigurationChangeDate(name);
}
public Object GetModelInfo(String infoType) { return null; }
Then in the ModelConfigSupport file:
public static DateTime GetLastConfigurationChangeDate(String configName) {
ModelConfig__c cfg = getConfigSetting(configName);
return(cfg.LastConfigurationSaveDate__c);
}
In the “Save” function for the model configuration (in the controller class for the configuration UI), simply add:
cfg.LastConfigurationSaveDate__c = Datetime.Now();
That’s it!
Once you’ve made these modifications, your custom model can be queried by the framework for its last modification time. If the last modification time was before the previous attribution rebuild, the framework will know it hasn’t been changed, and will allow the system to skip rebuilding of closed opportunities if that feature is enabled through configuration.
Comments
0 comments
Please sign in to leave a comment.