In this lesson, we improve the Time Tracker application by first adding a Status picklist field to allow for submitting, approving and rejecting Time Cards. We then proceed with enabling Field History Tracking and setting the fields to track. We also adjust the Chatter Feed Tracking to now track the Status picklist changes as well in the Chatter Feed of Time Cards.
We then create a more complex validation rule that is user specific. In our scenario, we wish to block the owner of a Time Card from Approving or Rejecting their own Time Card. This process calls on us to also adjust the President Profile Object Settings to grant further access rights to both the Time Entry and Time Card object.
You could further extend the functionality of this application with additional validation rules, such as not allowing the owner of a time card from changing the Total Hours of a Time Card once the Status has been set to Approved, for example.
Validation Rule Code on Time Card Object:
AND (OR (ISPICKVAL (Status__c, 'Approved'), ISPICKVAL(Status__c, 'Rejected')), Owner:User.Id = $User.Id )