7.1.6 Schedule Account Revenue Calculation
This section guides you through resetting the account summary fields for company turnover at the beginning of the year.
ADvendio is planning to implement an automated process for future releases.
Please make sure to use the Apex class: "AccountTurnover".
How to schedule the Apex Job
To schedule the Apex Job please follow these steps:
From Setup, enter Apex Classes in the Quick Find box, select Apex Classes, and then click Schedule Apex.
Choose a name for the job and specify the name of the class that you want to schedule (AccountTurnover).
Indicate how often the Apex class should run:
For Weekly—specify one or more days of the week the job is to run (e.g. Monday and Wednesday).
For Monthly—specify either the date or the day the job is to run (e.g. the second Saturday of every month.)
Set the start and end dates for the Apex scheduled class. If a single day is specified, the job runs only once.
Specify a preferred start time. The exact start time of the job depends on service availability.
Click Save.
Functions of the Apex Job
This Apex Class will:
Summarize the Turnover_Amount__c by adding up all related MediaCampaigns to the Account sorted by the following:
next calendar year,
this calendar year,
last calendar year,
the calendar year before last year
(if a fiscal year was set up):
Next Fiscal Year
This Fiscal Year
Last Fiscal Year
it is batchable and schedulable
refers to the Account and Agency lookup including all Media Campaigns
If you cannot find some of the fields needed, please ensure to add them to your layout in Setup.
New batch job Account Turnover Full Scope
With version 2.182 and onwards new batch class AccountTurnoverFullScopehas been introduced which is an upgraded processing job designed to give you a complete 360-degree view of an Account's financial performance within ADvendio.
Total Revenue Inclusion: Previously, turnover calculations primarily focused on direct Advertisers. This new job now captures and includes revenue from all Media Campaigns where the Account is designated as the Agency, providing a more realistic picture of the total business volume associated with that partner.
Automatic Historical Cleanup: To maintain high data quality, the job performs a deep scan of the last four years of historical data. This ensures that if a campaign's value or status was changed in the past, those changes are correctly propagated to the Account’s turnover fields, and any "ghost" or stale values from old records are purged.
Admin Action: This job runs as a separate technical process (
AccountTurnoverFullScope). Admins can schedule it to run periodically or trigger it manually when a full refresh of historical revenue data is required for auditing or end-of-year reporting.
Operation limitations of AccountTurnoverFullScope
Current Automatic Update Logic
Account Turnover data is primarily managed through a system-level Media Campaign Trigger. By default, ADvendio automatically recalculates and updates the Account turnover fields whenever a Media Campaign record is modified (e.g., status changes, amount updates).
Known Conflict: Account vs. Agency Revenue
While AccountTurnoverFullScope exists for calculating specific "Account and Agency turnover" users should be aware of the following synchronization conflict:
Trigger Precedence: Because the standard Account Turnover trigger is mandatory and executes on every Media Campaign save, it will frequently overwrite any specialized values generated by the "AccountTurnoverFullScope" job.
Result: If you have modified turnover fields to include both account and agency specific metrics, these values may be reverted to standard account gross amounts if the associated Media Campaign is edited post-calculation.
Operational Impact
Data Inconsistency: Users relying on custom agency-turnover figures may see those numbers change unexpectedly after normal campaign management activities.
Workaround: It is recommended to perform final account and agency revenue reporting / calculations by running
AccountTurnoverFullScopeone more time after all campaign modifications are finalized, or utilize a snapshot approach for such data.
Disabling the Media Campaign Trigger
With version 2.181 and onwards, ADvendio provides a Feature Toggle that allows administrators to completely disable the automatic Account Turnover calculation triggered by Media Campaign changes. When this toggle is active, the standard trigger no longer overwrites turnover values on campaign save, which eliminates the conflict described above for organizations that rely exclusively on the AccountTurnoverFullScope batch job for their turnover calculations.
This option is also recommended for organizations experiencing Apex heap size exceptions when saving Media Campaigns due to high data volumes.
To configure this toggle, create a FeatureSetting__c record with Feature Name set to "Account Turnover", Feature Setting Name set to "Disable Media Campaign Trigger", and Value set to "true". For full configuration details and behavior scenarios, see the Feature Toggle section in 2.1.7 Account Revenues/Turnover (2.1.7 Account Revenues/Turnover).