Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I run an upsert on a theoretical 100 records, all of which already exist in Salesforce, but only 4 of which have changed field values, will the last modified date for every record be set to the date that the upsert was run as opposed to the date that the record was last changed during the upsert, resulting in 96 record not having their last modified date changed. My understanding is that upsert only change the last modified date of the records that had changed field values.

share|improve this question
up vote 7 down vote accepted

The last modified date of the every record will definitely change ,since an update of record will eventually happen even if field values are not changed .

If you need to explicitly code such scenarios ,i would definitely recommend to do an explicit update and update only those records whose field values have changed .

  //List for update
   //List for insert
share|improve this answer
quick reply! Why would the record be updated if there are no values that are changing? seems counter intuitive to do this! – Bartley Jul 2 '14 at 8:43
Upserts or update work even without any change on the record .Try querying an account and do an update with no change .You will see update will still run and last modified date changed .So a DML statement is a stament that will execute irrespective of any change in the field level – Mohith Shrivastava Jul 2 '14 at 8:50

Running this in Dev Console updates the lastmodifieddate of the record:

Course__c c = new Course__c(id='a0C11000001W4s1EAC');
upsert c;

So yes, even without updating any values the record is updated. Note: This will run triggers and workflows as well.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.