Audit Log Setup
Prerequisites
To set up the Audit Log, you need to:
Have these user licenses | Have these permissions | Complete these tasks and review these topics before continuing |
---|---|---|
|
Set Up the Audit Log
When setting up the Audit Log, complete these tasks:
Configure the Audit Log Page Layout
-
From Setup, enter
object
in the Quick Find box, then select Objects. -
Click Audit Log.
-
Under Page Layouts, click Edit next to Audit Log Layout.
-
Add the following fields to the layout:
-
Cleared
-
New Audit Log
-
Originating Audit Log
-
-
On the toolbar, click Buttons.
-
Drag Packet Viewer into the Custom Buttons section.
-
Click Save.
Grant Permissions
Follow these steps to grant permissions for management personnel, FieldFX mobile users to sync with the Audit Log, or access to the Packet Viewer.
Management Personnel Permissions for Audit Log
Grant for them to use in Audit Log.
-
From Setup, enter
permissions
in the Quick Find box, then select Permission Sets. -
Open a permission set.
-
Under Apps, click Object Settings.
-
Click Audit Logs.
-
Click Edit.
-
Under Object Permissions, select Read, Create, and Edit.
-
Under Field Permissions, select Read and Edit for every field.
-
Click Save.
-
Repeat the above steps for other permission sets as needed.
-
Continue with FieldFX Mobile User Sync Permissions for Audit Log.
FieldFX Mobile User Sync Permissions for Audit Log
Grant FieldFX Mobile users permissions so that their syncs get recorded in the Audit Log.
-
From Setup, enter "permissions" in the Quick Find box, then select Permission Sets.
-
Open a permission set for FieldFX Mobile.
-
Under Apps, click Object Settings.
-
Click Audit Logs.
-
Click Edit.
-
Under Object Permissions, select Read, Create, and Edit.
-
Under Field Permissions, select Read and Edit for every field.
-
Click Save.
-
Repeat the above steps for other permission sets as needed.
Packet Viewer User Access
Grant users access to the Packet Viewer.
-
From Setup, enter
permission
in the Quick Find box, then select Permission Sets. -
Open a permission set for Visualforce pages.
-
Under Apps, click Visualforce Page Access.
-
Click Edit.
-
Add "FX5.PacketViewer" to Enabled Visualforce Pages.
-
Click Save.
-
Repeat the above steps for other permission sets as needed.
Email Notifications
You can set up email notifications to alert system administrators when sync upload errors occur.
System administrators can then resolve sync upload errors before they cause further disruption.
Set Up Email Notifications
-
Add an email template:
-
From Setup, enter
email templates
in the Quick Find box, then select Classic Email Templates. -
Click New Template.
-
Select Text.
-
Click Next.
-
In Folder, select "Unified Public Email Templates".
-
Select Available for Use.
-
In Email Template Name, enter "Sync Upload Error".
-
In Subject, enter "Sync Upload Error".
-
Copy the following text:
A sync upload error has just occurred. Details: Audit Log Entry: {!FX5__Audit_Log__c.Name} User: {!FX5__Audit_Log__c.FX5__User__c} Date/Time: {!FX5__Audit_Log__c.FX5__Event_Date__c} Record: {!FX5__Audit_Log__c.FX5__Tracking_Number__c} Error: {!FX5__Audit_Log__c.FX5__Message__c} Please access the Audit Log and resolve this sync upload error immediately.
-
Paste the text into Email Body.
-
Click Save.
-
-
Add a workflow rule:
Salesforce will retire Workflow Rules and their Process Builder. The current FieldFX Managed Package workflows and process builder should be migrated over the flows before that. Workflow Rules
Process Builder
For more information, see |
-
From Setup, enter
workflow rules
in the Quick Find box, then select Workflow Rules. -
Click New Rule.
-
In Object, select "Audit Log".
-
Click Next.
-
In Rule Name, enter
Sync Upload Error
. -
In Description, enter
Email notification for sync upload errors
. -
In Evaluate the rule when a record is, select created.
-
Under Rule Criteria, select the following:
-
Run this rule if the following: select Criteria are met
-
Field: Select Audit Log: Type
-
Operator: Select equals
-
Value: Select SyncUploadError
-
-
Click Save & Next.
-
Add an email alert:
-
-
Click Add Workflow Action → New Email Alert.
-
In Description, enter
Sync Upload Error
. -
In Email Template, select "Sync Upload Error".
-
In the Selected Recipients list, add the users to receive alerts about sync upload errors.
-
In From Email Address, select "Current User’s email address".
-
Click Save.
-
Click Done.
-
Click Activate.
List Views
You should set up custom list views to make tracking sync activity much easier.
We recommend that you create the following list views:
-
Unresolved Sync Upload Errors
Displays the Audit Log entries for sync upload errors you need to resolve.
-
Resolved Sync Upload Errors
Displays the Audit Log entries for sync upload errors you resolved.
Create the List Views
-
Open the Audit Logs tab.
-
Click Create New View.
-
Follow the steps in Add a new Custom View then customize the view as follows:
Type Step # Enter this… Unresolved Sync
Upload ErrorsIn View Name, enter `Unresolved Sync Upload Errors.
Enter the following:
Field Operator Value Type
contains
SyncUploadError
Cleared
equals
False
-
Select the following:
-
Audit Log ID
-
Event Date
-
User
-
Message
-
Tracking Number
-
Cleared
-
-
Click Add.
Select Visible to all users
Resolved Sync Upload Errors List View
Enter
Resolved Sync Upload Errors
.In Filter By Additional Fields, enter the following:
Field Operator Value Type
contains
SyncUploadError
Cleared
equals
True
-
In Available Fields, select the following:
-
Audit Log ID
-
Event Date
-
User
-
Message
-
Tracking Number
-
Cleared
-
-
Click Add.
Select Visible to all users.
-
-
Click Save.
Auto Delete
Use the Auto Delete feature to delete Audit Log entries automatically after a set number of days.
Delete SyncComplete and SyncDownloadComplete entries automatically after 30 days.
This keeps the Audit Log running more efficiently and reduces your administrative burden.
Set Up the Auto Delete Feature
-
Configure FX Settings:
-
From Setup, enter
custom settings
in the Quick Find box, then select Custom Settings. -
Click Manage next to FX Settings.
-
Click Edit.
-
In AuditLogRetainingDays, enter the number of days after occurring that you want to delete Audit Log entries.
Enter "30" to delete entries 30 days after they occurred.
-
In AuditLogTypeForTruncation, enter the types of Audit Log entries you want to delete automatically (use commas to separate multiple values).
Enter
SyncDownloadComplete,SyncUploadComplete
to delete SyncDownloadComplete and SyncUploadComplete entries only.As a best practice, never select to delete LoggedOutWithData or SyncUploadError entries.
-
Click Save.
-
-
Schedule the AuditLogTruncatorScheduler Apex class:
-
From Setup, enter
apex
in the Quick Find box, then select Apex Classes. -
Click Schedule Apex.
-
In Job Name, enter
Audit Log – Auto Delete
. -
In Apex Class, select "AuditLogTruncatorScheduler".
-
Select how often you want to delete old Audit Log entries.
Select a frequency of at least once per week, preferably daily.
-
Click Save.
-
Recommended Reading
-
Learn how the Audit Log works