How do we prevent un-necessary updates on a record? For example, a User(say A) is owner and creator of a record. There is a visualforce page which updates this record.
Can we prevent the Lastmodifieddate from being updated even though there aren't any changes to the record?
Please don't say that you have to query the record, compare the changes and then update the record.
OPTION 1 You can create a flag and init in FALSE, when A user change any value in the visualforce you can change the value of the flag. Before update the record you must verify the value of the flag, if is true you update the record.
OPTION 2 In the constructor of the visualforce you do a backup of the record. Before update the record you compare the backup with the original record.
If they are different then you can update the record