Usage Report Records
One of the most powerful features of Amberflo is Usage Analytics. Amberflo extends this feature to its Salesforce managed app.
Sync job
The application includes a sync job AFLO.UsageRecordDownloadScheduler which can be scheduled to import usage records from Amberflo. These usage records can be leveraged for reporting purposes in Salesforce. For each customer, usage is loaded by aggregating the values of the meter into a daily bucket.
The sync job can be scheduled to run daily. Every time the job runs, it fetches usage records from Amberflo with start date greater than the latest end date value in Salesforce. This way only the delta is synced between the two systems instead of bringing in all usage records.
Data schema
Usage report records are maintained as a custom object: UsageRecord. These records are related to the Amberflo customer object.
AFLO__UsageRecord__c
Field | Description |
---|---|
meterLabel | Meter label as displayed in Amberflo. |
totalValue | The daily aggregated value for the meter and customer. |
meterApiName | Meter API name as defined in Amberflo. |
customerId | customerId that references the Amberflo customer custom object. |
Start Date | Start of the daily aggregation bucket. The bucket is a day that starts at midnight UTC. |
End Date | End of the daily aggregation bucket. The end marker is midnight UTC of the next day. Note this value will be used as a starting point to import records the next time the job runs. |
Scheduling instructions
- Go to Setup
- Type "Apex"
- Select Apex Classes
- Click on the button Schedule Apex
- Enter the Job Name
- Select "UsageRecordDownloadScheduler" as Apex Class
- Set your schedule - we recommend to run daily at UTC midnight + 6 hrs
Reference https://help.salesforce.com/s/articleView?id=sf.code_schedule_batch_apex.htm&type=5
The job can also be run on demand from the Developer Console:
(new AFLO.UsageRecordDownloadScheduler()).execute(null);
Updated 9 months ago