You need to sign in to do that
Don't have an account?
Rohit K Sethi
Create AccountHistory record in test class.
Hi All,
Can we create the AccountHistory Reocrd in test class if it is possible plz post how ?
Thanks.
Can we create the AccountHistory Reocrd in test class if it is possible plz post how ?
Thanks.
Though this is not a right approach you can use Test.isRunningTest() for the coverage of the apex class.Please go through the following link:\
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_test.htm
Cheers,
Dhriti
All Answers
You can not perform any DML regarding this AccountHistory,though this particular object is dependent on the Account object.Records in AccounyHistory object stored in SF internally,you can only query to fetch records from this object.
AccountHistory actHistory =[SELECT CaseId,CreatedById,CreatedDate,Field,Id,IsDeleted,NewValue,OldValue FROM CaseHistory];
Please let me know if you need any further help
Cheers,
Dhriti
There is a great answer here (http://salesforce.stackexchange.com/questions/4007/is-it-possible-to-test-apex-that-relies-on-field-history-tracking) for your query
Please mark this as the best answer if this helps
Thanks for your quick response.
I know that we cannot create the Account History record . But my main class most of the code contains Account History record related conditions.
So I have to cover that area to achieve the 75%.
Thanks.
Though this is not a right approach you can use Test.isRunningTest() for the coverage of the apex class.Please go through the following link:\
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_test.htm
Cheers,
Dhriti