A guide to automated field updates within Salesforce
|Knowledge Article Number||000205468|
|Description||When testing automation, or troubleshooting field changes, there are a variety of sources that need to be considered as potential data changers:
Formula Fields: Perhaps the most intuitive way to update a field in Salesforce. Formula fields can base off most other fields on the record (or parent record), and update every time the record is refreshed.
Workflow Field update: For users with Professional Edition with workflow or higher Editions workflow triggers can carry out field updates to fields on the triggered record, or a (master detail) parent record. Triggering requires that the page be edited and saved, so bear in mind that the trigger will not action until this has happened. Note as well that if you change a look-up to a parent master record this will trigger all matching workflows, even if they are only meant to trigger on the initial matching of criteria. Updates can also be time-based, and take place a set time after or before any date field on the record.
Approvals Field update: Staying with Professional Edition with workflow or higher Editions, an Approval process is also another tool that can cause automated updates to data. The approval updates as similar to workflow updates, and in fact workflow rules and approval processes can share the same field updates. In an approval an update can occur as an "approve" or "reject" consequence of each step. Alternatively it can also occur as part of the overall approval/rejection of the submission as a whole. An edit is not necessary here, as the action of approving/rejecting will push through an edit to the record anyway, and as such the field update.
Visual Workflow: Again this is a tool available to Enterprise Edition and higher orgs. Visual workflow is a tool that can automatically update records based on inputs by a user. The updates will occur as the user cycles through a particular flow process, and the modification stamp will be set as such.
Apex DML statements: Apex is a form of coding that can be used within Salesforce to achieve levels of automation and functionality that declarative tools, such as workflow, just cannot give. As part of an Apex class we can have a number of DML statements. DML here stands for "Data Manipulation Language" and it is essentially a group of terms, such as "create", "update" and "delete", that are used for selecting, inserting, deleting and updating data into a database. A typical usage of Apex might be to find a particular record in the database, change the value of a field, and then save this change to the database using an "update" call. Apex can trigger on record creation and updates, as well as on the deletion of a record.
Integrations: Your company may use integration to other tools, that range from the well-known (such as Salesforce for Outlook) to background integrations (such as a SFDC/SAGE two-way update process). These also have the ability to update fields and records in Salesforce based on external systems, and vice versa.
|Resolution||There are a number of tools to help you work with these various types of automated field updates, and see what caused the update to occur:
Debug Logs: Will let you view the consequences of any action a user carries out (e.g. refreshing a record), such as workflow updates and Apex triggers triggered. It will also show validation rules passed and failed. Each debug log is limited to 20 actions, so only place a debug log on a user when you are ready to test. You can access and set debug logs on users from the set-up menu, by navigating to: "Monitoring -> Debug Logs".
Time-based workflow queue: This is a queue showing all time-based workflow actions scheduled to take place. It will also give information such as the workflow that triggered them, and the record and date they will action on. The time-based workflow queue can be accesses from the set-up menu by navigating to "Monitoring -> Time-Based Workflow".
Set-up Audit Trail: This is an audit of all changes made in the set-up menu, and can help you in determining if someone has modified one of your automation methods, such as a workflow, or an approval process. It tracks the area the change was made, as well as the user who carried out the change, and the date and time of modification. The Audit trail can be located from the set-up menu, by navigating to: "Security controls -> View set-up audit trail".
Field History Tracking - is a very useful tool that lets you track any changes made to a number of fields in each object. When activated it tracks the previous and new value of the field, the user who changed the field, and the date/time the change was made. This allows you views changes made by a variety of automated processes. Field history tracking can be activated by navigating to the object in the set-up menu, opening the object fields, and clicking the "Set History Tracking" button.