2

I am doing some pipeline research and basically need to create a "snapshot" using the opportunity history table. So I look for the the max created date prior to my chosen date. I get occasionally get more than 1 row per opportunity returned. Are records in this table created in batches? I just don't understand how two rows can be written at the same second.

  • Each record represent value change for the specified field, so when you have a few fields for the same record being updated at the same time it's possible – o-lexi Feb 3 '17 at 23:37
0

Take a look at the documentation on OpportunityHistory:

Usage

This object represents the history of a change to the Amount, Probability, Stage, or Close Date fields of an Opportunity. The OpportunityFieldHistory object represents the history of a change to any of the fields of an Opportunity. To obtain information about how a particular opportunity is progressing, query the OpportunityHistory records associated with a given Opportunity. Please note that if an opportunity's Amount, Probability, Stage, or Close Date fields have not changed, nothing will be returned in the OpportunityHistory objects. In this case, query the OpportunityFieldHistory records associated with a given Opportunity to get more information about changes to the opportunity.

So there are a few different scenarios to consider:

  • Zero OpportunityHistory records exist for a specific Opportunity record
    • The Amount, Probability, Stage, and Close Date fields have not changed since the record was created
  • Exactly one OpportunityHistory record exists for a specific Opportunity record
    • Of all the above mentioned fields, only one transaction has changed any of the values.
  • More than one OpportunityHistory record exists for a specific Opportunity record
    • Multiple transactions have changed the values of the aforementioned fields.

You are by no means guaranteed a one-to-one ratio.

Your Answer

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

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