function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
james.wallacejames.wallace 

History Old / New Values

Hi All,

 

Not sure if this is even possible as I have tried and failed miserably.  Is there anyway to access the old and new value fields from the history tables?  I can query the data from the table, but the old / new value fields are never returned:

 

Example

SuperfellSuperfell

You can access the old/new values, looks like hte query tool you're using is just not displaying them.

james.wallacejames.wallace

I am using the query tool that comes with the salesforce.com IDE (eclipse).  I have also tried running the same query through the .Net Library, which also didn't return the old / new values.  Am I missing something here?

SuperfellSuperfell

The fields are typed as xsd:anyType because each row can have different types, apparently the tools you mention don't handle this correctly. have you tried programatically accessing these values (i assume that's your ultimate goal)

SuperfellSuperfell

Also, if you have a Mac, SoqlX display these correctly.

james.wallacejames.wallace

So the IDE that salesforce provides can't handle these types of fields?  Could you point me in the direction of one that does?  I do not have a Mac, I am using Windows.  I have tried programmtically (using .Net, as above) with no success.

james.wallacejames.wallace

My ultimate goal is to use these fields programmatically (using apex) but I must ensure that I can access the data before I develop the functionality.

SuperfellSuperfell

I was able to read the values fine from apex, e.g. from the developer console, run

 

System.debug([select id,oldvalue,newvalue from accountHistory]);

 

the debug log showed

11:11:52:093 USER_DEBUG [1]|DEBUG|(AccountHistory:{NewValue=Apple Computer Inc, Id=0173000009BqDobAAF, OldValue=Apple Computer Inc.})

 

I also logged a bug with the IDE team for it not showing these fields correctly from the query.

sornasorna

Even i had the same issue - not with history old/new values...but with partner table...the eclipse or force.com ide showed blank values...and when i tried apex explorer i was able to view the values...but I just found that apex explorer was out dated and salesforce introduce force.com explorer as a replacement...so try this...it may work...

james.wallacejames.wallace

Thanks for the replies people, I eventually developed my solution manually by gradually making changes to the trigger I was working on.  It's not the most effective way to develop, but atleast it works.