You need to sign in to do that
Don't have an account?
Preethi77
In my Test Class, I Can able get Opportunity History but cannot able toget CaseHistory record
Opportunity opp = new Opportunity();
opp.StageName = 'Closed Won';
opp.Name = 'Testopp';
opp.CloseDate = system.today();
Insert opp;
List<OpportunityHistory> sd = [ SELECT Id, OpportunityId FROM OpportunityHistory
WHERE OpportunityId = :opp.Id ];
In my Test Class, I had put this code and I run this code, I can able to get opportunity History record corresponding opportunity.
Case ca = new Case();
ca.status = 'New';
ca.Origin = 'web';
Insert ca;
List<CaseHistory> fd = [ SELECT Id, CaseId FROM CaseHistory
WHERE CaseId = :ca.Id ];
But i cannot able to get case history record, i dont know why its happening? Please tel correct solution.
After inserting the case in test code please do some update on the same case.
Case ca = new Case();
ca.status = 'New';
ca.Origin = 'web';
Insert ca;
ca.type = 'Electrical';
update ca;
List<CaseHistory> fd = [ SELECT Id, CaseId FROM CaseHistory
WHERE CaseId = :ca.Id ];
Try the above code and check.
do u able to solve this?