[SalesForce] How to track the creation and last edited date of a custom field – best practice

Here i have issue regarding workflow or trigger.On Account level i have 2 fields..

1) Account note – text field

2) Account note modified date – date field

I want the Account Note Modified Date field to be updated with the current date when an Account is created or an Account is edited and the Account Note is modified.

SHould I use a workflow or a trigger?

Which one is more suitable? If workflow then can you help me with the criteria?

Best Answer

You could do this very easily with a Work flow rule.

Set up a Work Flow rule on the Account object.
Set the Evaluation Criteria to: created, and every time it’s edited In the Rule Criteria, set it to run if the formula evaluates to True

Set your formula to below

OR(
     ISNEW(),
     AND(
          NOT(ISNEW()),
          ISCHANGED(Account_Note__c)
     )
)

Then create a Workflow action of type, field update.

Set the the your Account note modified date field to

TODAY()

Save and activate the rule.

Now everytime an account is created this field is set to the current date, and if the account is edited and the Account Note field is edited, the field will be set to the current date.

Hope that helps.