You need to sign in to do that
Don't have an account?
SOQL query to return username from history object
We have a custom object that has a corresponding history object to track changes. I am trying to write a query to retrieve the history information, including username in as efficient a manner possible since I am going through the API. I can write a query such as:
Select createdbyid, newvalue, oldvalue from My_Object_History__c
But what I really want is something like the following so I do not have to round trip back to the server to get the username:
Select (username from user where id = createdbyid), newvalue, oldvalue from My_Object_History__c
Can someone help and let me know if this is possible and if so, how?
I used the salesforce.schema tool in the Force.com IDE to come up with the following SOQL statement by simply clicking -
Select c.OldValue, c.NewValue, c.CreatedBy.Username, c.CreatedById From Candidate__History c
for the history on the Candidate__c custom object. Would this work for you?