2

I have requirement to send an email with list of changes from the last approval date when an user clicks on approval button on a custom object.

I have enabled Field History Tracking on some fields and using Apex logic for querying the History object where CreateDate is greater than the last approval date. It seems fine and I am getting what I wanted However I am not sure this is the best approach.

Would appreciate If you give some input or recommend any better approach.

Thanks.

1 Answer 1

1

Yes that's a normal approach. I've used it in the past as well.

In some cases you might find out that this solution is not sufficient, i.e.:

  1. you don't have enough history fields on an object to track all fields.
  2. you want to be absolutely sure that any newly added field is tracked as well, even if you forget to activate history tracking for that field.
  3. the (standard) object doesn't have field history (e.g. Product2)
  4. you need other data in the history as well (e.g. the previous approver)
  5. you need specific reporting on historic data which the 'normal' history reporting does not cover.

In that case it could be useful creating an additional history-object and creating a trigger that creates history records upon each field edit on the object. By leveraging the metadata functions you can always fetch the up-to-date list of fields and it is quite straightforward to fill the history object.

Note that this will possibly require a lot of extra storage space. Standard history data does not count towards the storage limits. Custom history data does (it is seen as a normal custom object).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .