You need to sign in to do that
Don't have an account?
ryan_mm
Something strange with the OpportunityHistory table
Hi folks - We found an Opportunity record that has a set of cooresponding OpportunityHistory records with something strange: there are two OpportunityHistory records with the exact same CreatedDate (including seconds) but the one that comes back second when querying and doing an ORDER BY CreatedDate doesn't seem to have the right values. It looks something like this:
Opportunity Table
ID StageName
00640000009sJMSAA2 Proof of Concept
OpportunityHistory Table
ID OpportunityID CreatedDate StageName
0084000000GIjuzAAD 00640000009sJMSAA2 2008-06-10 4:31:48PM Proof of Concept
0084000000GIjvCAAT 00640000009sJMSAA2 2008-06-10 4:31:48PM Demo Scheduled
As far as we know the user just clicked the Save button once and had changed from Demo Scheduled to Proof of Concept. Shouldn't the last record in the OpportunityHistory table ALWAYS match the current value of the cooresponding opportunity record? At first we thought that the two OpportunityHistory records were out of order maybe due to a rounding error on the time or something. But the IDs seem to the imply that the second record was in fact created last because it has a "larger" ID. So we're confused.
This is messing up our calculations because our logic that looks through the OpportunityHistory table determines that this Opportunity is now at the Demo Completed stage which is wrong.
Any ideas on why this would happen or how to work-around it?
Ryan
Opportunity Table
ID StageName
00640000009sJMSAA2 Proof of Concept
OpportunityHistory Table
ID OpportunityID CreatedDate StageName
0084000000GIjuzAAD 00640000009sJMSAA2 2008-06-10 4:31:48PM Proof of Concept
0084000000GIjvCAAT 00640000009sJMSAA2 2008-06-10 4:31:48PM Demo Scheduled
As far as we know the user just clicked the Save button once and had changed from Demo Scheduled to Proof of Concept. Shouldn't the last record in the OpportunityHistory table ALWAYS match the current value of the cooresponding opportunity record? At first we thought that the two OpportunityHistory records were out of order maybe due to a rounding error on the time or something. But the IDs seem to the imply that the second record was in fact created last because it has a "larger" ID. So we're confused.
This is messing up our calculations because our logic that looks through the OpportunityHistory table determines that this Opportunity is now at the Demo Completed stage which is wrong.
Any ideas on why this would happen or how to work-around it?
Ryan
then you get
0084000000GIjuz
0084000000GIjvC
and the ascii value of z is 122
ascii value of C is 67
so i would conclude that 'C' < 'z'
so, if the dates don't resolve order completely you can try truncate to 15 chars and then sort by ascii.
i have no idea how this gets created at the same time unless there is a workflow or trigger helping the process along...
Ryan