Two types of transactions work on a set of records. First type selects records that don't have a flag set and sets it. The second transaction selects those records that have a flag set and removes the flag.

It would appear that those transaction types are mutually exclusive. However, field history reports that a record had the flag set and then removed at exactly the same timestamp.

My question is when exactly are history records created? Are they created when a transaction finally commits or with each DML call of the transaction?

  • 1
    What exactly do you mean by the 'second transaction'? Truly two different SFDC transactions or just triggers firing a second time, say after a RSF, workflow field update, or process builder update? – cropredy Nov 22 '17 at 16:51
  • @cropredy Two different transactions initiated by two http requests. – ipavlic Nov 23 '17 at 6:32
  • Then the history records should have different timestamps - since the UI time resolution is not down to the ms; did you do SOQL on the actual history records to see their CreatedDate field value? – cropredy Nov 24 '17 at 6:45
  • I did, and the timestamps are exactly the same. – ipavlic Nov 24 '17 at 19:58
  • weird - are you sure the first transaction doesn't (via a workflow or PB) reset the flag? – cropredy Nov 24 '17 at 21:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.