If field history tracking is enabled for an object, the changes are stored in history table for that particular object.
The API name of these tables follows a simple convention so should be easy to find. For standard objects,
the name of the history table follows the format: 'ObjectNameHistory' so for the Account object the history table is AccountHistory.
For custom objects, the name of the convention simply replaces the 'c' on the end of the API name with 'History'.
So, for a custom object call My_Custom_Object__c the history table is called My_Custom_Object__History.
ex :
SELECT AccountId, OldValue, NewValue, IsDeleted, Id, Field, CreatedBy.Name From AccountHistory WHERE AccountId=:accountId ORDER BY CreatedDate DESC
SELECT Id, Name, (Select OldValue, NewValue From Histories) FROM My_Custom_Object__c
SELECT OldValue, NewValue, Parent.Id, Parent.name, Parent.customfield__c FROM My_Custom_Object__history
SELECT Name, customfield__c, (SELECT ParentId, OldValue, NewValue,Field FROM Histories ) FROM Custom_Object__c
Note : The child history relationship name is called "histories".
SELECT ID, Subject, Type, (SELECT Field, OldValue, NewValue FROM Histories) FROM Case
Field History Tracking in Salesforce :
Out of the box Salesforce can track up to 20 fields per object using field history and retains that information for 18 months.
The benefit of this is displayed on the record in a related list and is even reportable.
Field history data is retained for up to 18 months through your org, and up to 24 months via the API.
Field history tracking data doesn't count against your Salesforce org's data storage limits.
You can track the field history of custom objects and the following standard objects.
Limitations Of Using Field History Tracking
1.You can only track 20 fields per object.
2.For some fields like Text Area (Long), Text Area (Rich), and Picklist (Multi-Select) and Changes to fields with more than 255 characters are tracked as edited,
and their old and new values are not saved.
3.If a trigger causes changes to objects for which the user does not have permission to edit, the change is not tracked.
Field history takes into account current user permissions.
Field Audit Trail :
Field Audit Trail uses a similar experience but extends those limits to track up to 60 fields and will retain as much as ten years.
Field Audit Trail is a separate add-on feature.It also comes under the Salesforce Shield Product.
Retain Field History for upto 10 years with Field Audit Trail.
Salesforc Shield :
To protect the application data and maintain the customer trust, Salesforce Introduced Salesforce Shield. Salesforce Shield offers a powerful set of tools
for any customer who needs an extra level of control to meet internal or regulatory compliance requirements.
Salesforce Shield is made up of three components :
1.Platform Encryption
2.Event Monitoring
3.Field Audit Trail
Platform Encryption :
Platform Encryption allows you to encrypt fields, files, and attachments stored in the Salesforce1 Platform. In contrast to Classic Encryption,
which uses a custom field type in the Salesforce data model, Platform Encryption allows you to encrypt several standard fields and
custom field types using metadata while preserving functionality necessary to perform common business tasks in Salesforce.
Note : Natively Encrypt sensitive data
Event Monitoring:
Event monitoring lets you to easily see what data users are accessing, from what IP address, and the actions done to that data.
For Example API calls, user logins, users who are running reports, exporting reports, downloading files, and etc.
Note : Detailed data & Monitoring
Field Audit Trail :
It is used to track information about who, when and what data has changed. Current data retention period is 18 months and we can track up to 20 fields only,
but by upgrading to Field Audit Trail with History tracking, we can track up to 60 fields and can retain data for 10 years.
Note : Prevents Data loss
No comments:
Post a Comment