Skip to main content
Full Circle Insights

The FCI_CampaignInfluenceAPI Class Interfaces and Methods

The FCI_CampaignInfluenceAPI Class Interfaces and Methods

The CampaignInfluenceAPI class is a global class that defines and implements the interface between the campaign attribution systems of the two applications and your campaign attribution plugin.

The ICampaignAttributionType interface


The following methods are defined on this interface:

Interface Member Description

String GetUniqueName()

You must return a unique name for your attribution model. We recommend you include your company name as part of this string in order to assure that it does not conflict with other company's models. This string is used to differentiate between models.

String GetDescription()

You must return a description of your plugin. This is the text that is displayed to users on the configuration panel and in reports. This value should be localized.

String GetManufacturer()

Optional – return your company name.

String GetCopyright()

Optional – return a copyright notice for your plugin.

List<ICampaignAttributionConfiguration> GetConfiguredInstances()

Retrieve a list of all model instances (instances of classes that implement the ICampaignAttributionConfiguration interface

void CreateConfiguredInstance(String name, String description)

Create a new instance of this model with a given name and description. It is the responsibility of the model to store and manage the settings for each configured instance.

void DeleteConfiguredInstance(String name)

Delete an instance of this model with the specified instance name.

 

The ICampaignAttributionConfiguration interface

The following methods are defined on this interface:

Interface Member Description

String GetUniqueName()

You must return a unique name for an instance of your attribution model. This name is unique for instances of this model – not necessarily across all models.

void SetUniqueName(name)

Sets the unique name for this model instance.

String GetDescription()

You must return a description of this instance. This is the text that is displayed to users on the configuration panel and in reports. This value should be localized.

void SetDescription(name)

Sets the description for this model instance.

String GetManufacturer()

Optional – return your company name.

String GetCopyright()

Optional – return a copyright notice for your plugin.

String GetConfigurationTypeName()

Return the Unique Name of the Model (the result of the GetUniqueName() method call on the ICampaignAttributionType interface for this model).

PageReference GetConfigurationPage()

Optional – return a PageReference to your plugin's configuration page. Return null if you have no configuration page.

Boolean GetSupportsAccountInfluence()

Return true if your plugin supports the AccountDetermineAttribution method for assigning campaign attribution. If this returns true, GetSupportsOpinfluence should return false.

Boolean GetSupportsOpInfluence()

Return true if your plugin supports the OpportunityDetermineAttribution method for assigning campaign attribution. If this returns true, GetSupportsAccountInfluence should return false.

Set<String> GetCMFieldsToQuery

Specifies a set of additional CampaignMember fields to include in SOQL queries on the CampaignMember object during processing.

Set<String> GetOpportunityFieldsToQuery

Specifies a set of additional Opportunity fields to include in SOQL queries on the Opportunity object during processing.

Set<String> GetAccountFieldsToQuery

Specifies a set of additional Account fields to include in SOQL queries on the Account object during processing. Only applies to models using account attribution

String AccountDetermineAttribution( 
…)

This method is called if your plugin returns true to the GetSupportsAccountInfluence method. This method is described in detail in the AccountDetermineAttribution Method documentation in the Assigning Attribution section.

String OpportunityDetermineAttribution( …)

This method is called if your plugin returns true to the GetSupportsOpInfluence method (This method is described in detail in the OpportunityDetermineAttribution Method documentation in the Assigning Attribution section.

Campaing Attribution
void DetailObjectUpsert(String influencetype, List<FCI_Influence_Details__c> influenceobjects, Map<ID,CampaignMember> cmsMap<ID, Opportunity> ops

Response Management
void DetailObjectUpsert(String influencetype, List<FCR_Influence_Details__c> influenceobjects, Map<ID,CampaignMember> cmsMap<ID, Opportunity> ops

This method is called before insert or update of attribution detail objects (objects have different api names in the two applications). It includes parameters containing a map of all CampaignMember and Opportunity objects related to the attribution detail objects being upserted. During this method you can modify the attribution detail objects. For example, you can use this method to sync additional fields from the CampaignMember or Opportunity objects to custom fields you've created on the attribution detail objects. 
You should not modify the contents of any of the predefined fields during this method.

String Start()

This method is called at the beginning of the attribution batch processing. You may return a string that defines the state of your plugin. This string will be included with each AccountProcessAttribution or OpportunityProcessAttribution method call. These calls can modify the state as well.

void Finish(State)

This method is called on completion of attribution processing. The current state string is provided as a parameter. Note: This function will not be called if the batch processing is aborted.


The sequence of calls is as follows:

  • GetUniqueName, GetDescription, GetManufacturer, GetCopyright, GetConfigurationPage, GetSupportsAccountInfluence, GetSupportsOpInfluence, GetCMFieldsToQuery, GetOpportunityFieldsToQuery and GetAccountFieldsToQuery – May be called at any time to identify and configure your plugin.
  • Start – Called once at the beginning of the attribution batch process.
  • AccountDetermineAttribution, OpportunityDetermineAttribution – Called once for each batch during attribution processing. Note that the system does not preserve class instances between calls to these functions. In other words, a new instance of your class will be created for each call.
  • Finish – Called at the end of the attribution batch process. This function will not be called if the batch processing is aborted. Be sure to free any state memory (object instance variables, particularly collections) when this method is called.

The IInfluenceDetailExtension interface

This interface can optionally be implemented by a model to receive additional method calls, including notification when a new influence detail object is being created, information on the time of the rebuild start (so it would be possible to determine if it had been already updated during this rebuild), and when an influence detail record is being updated for the first time for the current revenue type.

These changes make it possible for a custom model to correctly initialize it's own custom fields based on various situations when more than one instance of the model is configured.

The following methods are defined on this interface:

Interface Member Description
InitializeNewInfluenceDetailObject(FCR_Influence_Detail__c newObject, Integer modelNumber) Called for each new influence detail object - includes the model number
StandardFieldsUpdating(FCR_Influence_Detail__c newObject, Integer modelNumber, DateTime rebuildStartTime) Called the first time an influence detail object is updated for this rebuild and revenue model. Includes model number. Also includes the rebuild start time so that it's possible to determine if the record was updated already by a previous revenue model.
DetailObjectUpsert(String influencetype, List<FCR_Influence_Detail__c> influenceobjects, Map<ID, CampaignMember> allcms, Map<ID, Opportunity> allops, Integer modelNumber) This method is similar to the method on the interface ICampaignAttributionConfiguration, but this one takes the model number as a parameter. If both interfaces are implemented, this one will be called.

Maintaining State

The Full Circle CRM Response Management System uses APEX batch processing. The ICampaignAttributionConfiguration.Start function is called before executBatch is called. The ICampaignAttributionConfiguration.AccountDetermineAttribution and ICampaignAttributionConfiguration.OpportunityDetermineAttribution methods are called during the batch Execute calls. The ICampaignAttributionConfiguration.Finish method is called during the batch finish function if the batch terminates normally. The ICampaignAttributionConfiguration.Finish is not called if a batch is aborted (this includes cases where the batch is aborted due to limits being exceeded).  

A separate instance of your plugin class may be created for each method call. If you wish to maintain state between those instances, you may use a State string. You can return this string as the result of the ICampaignAttributionConfiguration Start, AccountDetermineAttribution and OpportunityDetermineAttribution method calls. The current value of the state string is passed as a parameter to the ICampaignAttributionConfiguration AccountDetermineAttribution, OpportunityDetermineAttribution and Finish methods.
Use XML or JSON serialization to preserve complex data in the state string.

Limits

Your plugin, like any APEX code, must adhere to limits. In most cases, your code will be sharing the limits of your organization. Use the following guidelines when building your plugin:

  • Your trigger should be as efficient as possible, as it may be called frequently. Avoid placing SOQL, DML or significant computation in the trigger or in your plugin object's constructor. Plugin initialization should be done during the Start method call.
  • The GetUniqueName, GetDescription, GetManufacturer, GetCopyright, GetConfigurationPage, GetSupportsAccountInfluence, GetSupportsOpInfluence, and GetEnabled methods are called in a standard SFDC context. There should be no need to perform any significant operations during these calls beside reading from your plugins configuration settings.
  • The Start and Finish methods are called in a standard SFDC context. In addition to the application overhead, your model may be sharing these limits with up to two other plugins. You should not exceed 25% of the currently defined limits for your org. You should clear any object arrays to free up memory when the Finish statement is called.
  • The AccountDetermineAttribution and OpportunityDetermineAttribution methods are called once for each batch execute during attribution processing. In addition to the application overhead, your model may be sharing these limits with up to two other plugins. You should not exceed 25% of the currently defined batch limits for your org. Note that batch limits are much higher than standard limits.
  • Your state string is subject to APEX heap limits. These limits are also shared with both the infrastructure and other plugins.
  • If you find your model is exceeding limits, you can reduce the batch size for campaign attribution processing using the Advanced Configuration page.
  • Was this article helpful?