Field History Tracking. salesforce Salesforce Organization
Реклама
Реклама
Set Up and Maintain Your Salesforce Organization Field History Tracking
Setup Changes Tracked
•
Visual Workflow files
•
Packages from Force.com AppExchange that you installed or uninstalled
Using the application
•
Account team and opportunity team selling settings
•
Activating Google Apps services
•
Mobile configuration settings, including data sets, mobile views, and excluded fields
•
Users with the “Manage External Users” permission logging in to the partner portal as partner users
•
Users with the “Edit Self-Service Users” permission logging in to the Salesforce Customer Portal as Customer
Portal users
•
Partner portal accounts, enabling or disabling
•
Salesforce Customer Portal accounts, disabling
•
Salesforce Customer Portal, enabling or disabling
•
Creating multiple Customer Portals
•
Entitlement processes and entitlement templates, changing or creating
•
Self-registration for a Salesforce Customer Portal, enabling or disabling
•
Customer Portal or partner portal users, enabling or disabling
SEE ALSO:
Field History Tracking
You can select certain fields to track and display the field history in the History related list of an object. The field history data is retained for up to 18 months.
You can track the field history of custom objects and the following standard objects.
•
Accounts
•
Articles
•
Assets
•
Campaigns
•
Cases
•
Contacts
•
Contracts
•
Contract line items
•
Entitlements
•
Leads
•
Opportunities
•
Orders
•
Order Products
•
Products
788
EDITIONS
Available in: Salesforce
Classic, Lightning
Experience, and the
Salesforce app
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Standard Objects are not available in Database.com
Set Up and Maintain Your Salesforce Organization Field History Tracking
•
Service Contracts
•
Solutions
Modifying any of these fields adds an entry to the History related list. All entries include the date, time, nature of the change, and who made the change. Not all field types are available for historical trend reporting. Certain changes, such as case escalations, are always tracked.
Note:
Field history increases beyond your current limits require purchasing the Field Audit Trail add-on following the Spring ’15 release. When the add-on subscription is enabled, your field history storage is changed to reflect the retention policy associated with the offering. If your org was created before June 2011 and your field history limits remain static, Salesforce commits to retain your field history without a limit. If your org was created after June 2011 and you decide not to purchase the add-on, field history is guaranteed to be retained for 18 months.
Consider the following when working with field history tracking.
•
Changes to fields with more than 255 characters are tracked as edited, and their old and new values are not recorded.
•
Tracked field values are not automatically translated; they display in the language in which they were made. For example, if a field is changed from
Green
to
Verde
,
Verde
is displayed no matter what a user’s language is, unless the field value has been translated into other languages via the Translation Workbench. This also applies to record types and picklist values.
•
Changes to custom field labels that have been translated via the Translation Workbench are shown in the locale of the user viewing the History related list. For example, if a custom field label is
Red
and translated into Spanish as
Rojo
, then a user with a Spanish locale sees the custom field label as
Rojo
. Otherwise, the user sees the custom field label as
Red
.
•
Changes to date fields, number fields, and standard fields are shown in the locale of the user viewing the History related list. For example, a date change to
August 5, 2012
shows as
8/5/2012
for a user with the English (United States) locale, and as
5/8/2012
for a user with the English (United Kingdom) locale.
•
If a trigger causes a change on an object the current user doesn’t have permission to edit, that change is not tracked because field history honors the permissions of the current user.
IN THIS SECTION:
Track Field History for Standard Objects
You can enable field history tracking for standard objects in the object’s management settings.
Track Field History for Custom Objects
You can enable field history tracking for custom objects in the object’s management settings.
Disable Field History Tracking
You can turn off field history tracking from the object’s management settings.
Field Audit Trail lets you define a policy to retain archived field history data up to 10 years, independent of field history tracking. This feature helps you comply with industry regulations related to audit capability and data retention.
SEE ALSO:
Track Field History for Standard Objects
Track Field History for Custom Objects
Disable Field History Tracking
789
Set Up and Maintain Your Salesforce Organization Field History Tracking
Track Field History for Standard Objects
You can enable field history tracking for standard objects in the object’s management settings.
If you use both business accounts and person accounts, review the following before enabling account field history tracking:
•
Field history tracking for accounts affects both business accounts and person accounts.
•
Enabling field history tracking on person accounts does not enable field history tracking on personal contacts.
To set up field history tracking:
1. From the management settings for the object whose field history you want to track, go to the fields area.
2. Click Set History Tracking.
Tip: When you enable tracking for an object, customize your page layouts to include the object’s history related list.
EDITIONS
Available in: Salesforce
Classic, Lightning
Experience, and the
Salesforce app
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Standard Objects are not available in Database.com
3. For accounts, contacts, leads, and opportunities, select the
Enable Account History
,
Enable Contact History
,
Enable Lead History
, or
Enable
Opportunity History
checkbox.
4. Choose the fields you want tracked.
You can select a combination of up to 20 standard and custom fields per object. This limit includes fields on business accounts and person accounts.
Certain changes, such as case escalations, are always tracked.
USER PERMISSIONS
To set up which fields are tracked:
•
Customize Application
You can’t track the following fields:
•
Formula, roll-up summary, or auto-number fields
•
Created By
and
Last Modified By
•
Expected Revenue
field on opportunities
•
Master Solution Title
or the
Master Solution Details
fields on solutions; these fields display only for translated solutions in organizations with multilingual solutions enabled.
5. Click Save.
Salesforce tracks history from this date and time forward. Changes made prior to this date and time are not included.
SEE ALSO:
790
Set Up and Maintain Your Salesforce Organization Field History Tracking
Track Field History for Custom Objects
You can enable field history tracking for custom objects in the object’s management settings.
1. From the management settings for the custom object, click Edit.
2. Select the
Track Field History
checkbox.
Tip: When you enable tracking for an object, customize your page layouts to include the object’s history related list.
3. Save your changes.
4. Click
Set History Tracking
in the Custom Fields & Relationships section.
This section lets you set a custom object’s history for both standard and custom fields.
5. Choose the fields you want tracked.
You can select up to 20 standard and custom fields per object. You can’t track:
•
Formula, roll-up summary, or auto-number fields
•
Created By
and
Last Modified By
6. Click Save.
Salesforce tracks history from this date and time forward. Changes made prior to this date and time are not included.
EDITIONS
Available in: Salesforce
Classic, Lightning
Experience, and the
Salesforce app
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Standard Objects are not available in Database.com
USER PERMISSIONS
To set up which fields are tracked:
•
Customize Application
SEE ALSO:
Find Object Management Settings
791
Set Up and Maintain Your Salesforce Organization Field History Tracking
Disable Field History Tracking
You can turn off field history tracking from the object’s management settings.
Note: You can’t disable field history tracking for an object if Apex references one of its a field on the object is referenced in Apex.
1. From the management settings for the object whose field history you want to stop tracking, go to Fields.
2. Click
Set History Tracking
.
3. Deselect Enable History for the object you are working with—for example, Enable Account
History, Enable Contact History, Enable Lead History, or Enable Opportunity History.
The History related list is automatically removed from the associated object’s page layouts.
If you disable field history tracking on a standard object, you can still report on its history data up to the date and time that you disabled tracking. If you disable field history tracking on a custom object, you cannot report on its field history.
4. Save your changes.
SEE ALSO:
Find Object Management Settings
EDITIONS
Available in: Salesforce
Classic, Lightning
Experience, and the
Salesforce app
Available in: Contact
Manager, Group,
Professional, Enterprise,
Performance, Unlimited,
Developer, and
Database.com Editions
Standard Objects are not available in Database.com
USER PERMISSIONS
To set up which fields are tracked:
•
Customize Application
Field Audit Trail
Field Audit Trail lets you define a policy to retain archived field history data up to 10 years, independent of field history tracking. This feature helps you comply with industry regulations related to audit capability and data retention.
Use Salesforce Metadata API to define a retention policy for your field history. Then use REST API,
SOAP API, and Tooling API to work with your archived data. For information about enabling Field
Audit Trail, contact your Salesforce representative.
Field history is copied from the History related list into the
FieldHistoryArchive
object and then deleted from the History related list. You define one
HistoryRetentionPolicy for your related history lists, such as Account History, to specify Field Audit Trail retention policies for the objects you want to archive. You can then deploy the object by using the Metadata API
(Workbench or Force Migration Tool). You can update the retention policy on an object as often as you like.
You can set field history retention policies on the following objects.
•
Accounts
•
Cases
•
Contacts
•
Leads
•
Opportunities
•
Assets
•
Entitlements
EDITIONS
Available in: Salesforce
Classic
Available in: Enterprise,
Performance, and
Unlimited Editions
USER PERMISSIONS
To specify a field history retention policy:
•
Retain Field History
792
Set Up and Maintain Your Salesforce Organization Field History Tracking
•
Service Contracts
•
Contract Line Items
•
Solutions
•
Products
•
Price Books
•
Custom objects with field history tracking enabled
Note:
HistoryRetentionPolicy
is automatically set on the above objects, once Field Audit Trail is enabled. By default, data is archived after 18 months in a production organization, after one month in a sandbox organization, and all archived data is stored for 10 years. The default retention policy is not included when retrieving the object’s definition through the Metadata API.
Only custom retention policies are retrieved along with the object definition.
You can include field history retention policies in managed and unmanaged packages.
The following fields can't be tracked.
•
Formula, roll-up summary, or auto-number fields
•
Created By and Last Modified By
•
Expected Revenue field on opportunities
•
Master Solution Title or the Master Solution Details fields on solutions
•
Long text fields
•
Multi-select fields
After you define and deploy a Field Audit Trail policy, production data is migrated from related history lists such as Account History into the
FieldHistoryArchive
object. The first copy writes the field history that’s defined by your policy to archive storage and sometimes takes a long time. Subsequent copies transfer only the changes since the last copy and are much faster. A bounded set of
SOQL is available to query your archived data.
Note:
If your organization has Field Audit Trail enabled, previously archived data isn't encrypted if you turn on Platform Encryption later. For example, your organization uses Field Audit Trail to define a data history retention policy for an account field, such as the phone number field. After enabling Platform Encryption, you turn on encryption for that field, and phone number data in the account is encrypted. New phone number records and previous updates stored in the Account History related list are encrypted.
However, phone number history data that is already archived in the
FieldHistoryArchive
object continues to be stored without encryption. If your organization needs to encrypt previously archived data, contact Salesforce. We will encrypt and rearchive the stored field history data, then delete the unencrypted archive.
IN THIS SECTION:
SEE ALSO:
SOAP API Developer Guide: FieldHistoryArchive
Metadata API Developer Guide: HistoryRetentionPolicy
ISVforce Guide: Overview of Packages
Force.com SOQL and SOSL Reference: SOQL with Archived Data
793
Set Up and Maintain Your Salesforce Organization Field History Tracking
Examples
Set Data Retention Policy for Field History
This example demonstrates how to set a field history data retention policy by using Metadata API. You need to edit the metadata only if you want to override the default policy values (18 months of production storage and 10 years of archive storage). Setting data retention policy involves creating a metadata package and deploying it. The package consists of a
.zip
file that contains an objects
folder with the XML that defines each object’s retention policy, and a project manifest that lists the objects and the API version to use.
Note:
The first copy writes the entire field history that’s defined by your policy to archive storage and might take a long time.
Subsequent copies transfer only the changes since the last copy, and will be much faster.
1. Define a field history data retention policy for each object. The policy specifies the number of months that you want to maintain field history in Salesforce, and the number of years that you want to retain field history in the archive. The following sample file defines a policy of archiving the object after six months, and keeping the archives for five years.
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<historyRetentionPolicy>
<archiveAfterMonths>6</archiveAfterMonths>
<archiveRetentionYears>5</archiveRetentionYears>
<description>My field history retention</description>
</historyRetentionPolicy>
<fields>
<fullName>AccountSource</fullName>
...
</CustomObject>
The file name determines the object to which the policy is applied. For example, to apply the above policy to the Account object, save the file as
Account.object
. For existing custom objects, this works the same way, with the file named after the custom object. For example: myObject__c.object
.
2. Create the project manifest, which is an XML file that’s called package.xml
. The following sample file lists several objects for which data retention policy is to be applied. With this manifest file, you expect the objects folder to contain five files:
Account.object
,
Case.object
, and so on.
<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members>Account</members>
<members>Case</members>
<members>Contact</members>
<members>Lead</members>
<members>Opportunity</members>
</types>
<version>32.0</version>
</Package>
3. Create the
.zip
file and use the deploy()
function to deploy your changes to your production environment. For more information, see the Metadata API Guide .
Note:
This pilot doesn’t support deployment from sandbox to production environments.
That’s it! Your field history retention policy will go into effect according to the time periods that you set.
794
Set Up and Maintain Your Salesforce Organization Field History Tracking
Create a Custom Object and Set Field History Retention Policy at the Same Time
You can use Metadata API to create a custom object and set retention policy at the same time. You must specify the minimum required fields when creating a new custom object. Here’s sample XML that creates an object and sets field history retention policy:
<?xml version="1.0" encoding="UTF-8"?>
<CustomObject xmlns="http://soap.sforce.com/2006/04/metadata">
<deploymentStatus>Deployed</deploymentStatus>
<enableHistory>true</enableHistory>
<description>just a test object with one field for eclipse ide testing</description>
<historyRetentionPolicy>
<archiveAfterMonths>3</archiveAfterMonths>
<archiveRetentionYears>10</archiveRetentionYears>
<gracePeriodDays>1</gracePeriodDays>
<description>Transaction Line History</description>
</historyRetentionPolicy>
<fields>
<fullName>Comments__c</fullName>
<description>add your comments about this object here</description>
<inlineHelpText>This field contains comments made about this object</inlineHelpText>
<label>Comments</label>
<length>32000</length>
<trackHistory>true</trackHistory>
<type>LongTextArea</type>
<visibleLines>30</visibleLines>
</fields>
<label>MyFirstObject</label>
<nameField>
<label>MyFirstObject Name</label>
<type>Text</type>
</nameField>
<pluralLabel>MyFirstObjects</pluralLabel>
<sharingModel>ReadWrite</sharingModel>
</CustomObject>
Set trackHistory
to true
on the fields that you want to track and false
on the other fields.
Update Data Retention Policy for Field History
If a field history data retention policy is already defined on an object, you can update the policy by specifying a new value of
HistoryRetentionPolicy
in the metadata for that object. Once you deploy the metadata changes, the new policy overwrites the old one.
Note: To check the current data retention policy for any object, retrieve its metadata using Metadata API and look up the value of
HistoryRetentionPolicy
.
795
Скачать
Реклама