+ Start a Discussion
sivadevsivadev 

How can I filter on the Old / New Value in a history report?

Can anbody please suggest me how can i add Old / New Value in reports


Many Thanks
Siva
Anil SavaliyaAnil Savaliya
Hi Siva,
Filter is not enable for old/New Value  by salesforce in SOQL,But you can run for loop and make list<> ,For filtered data.
sivadevsivadev
Hi Andys323

Thanks For replay can you please elaborate your answer if possible with example it helps me understand clearly please

Many Thanks
Siva
Anil SavaliyaAnil Savaliya
Hi Siva,

List<String> StatusChangedID ;
        List<CaseHistory> CH = [SELECT Id, CaseId, Field, CreatedById, CreatedDate, IsDeleted, NewValue, OldValue FROM CaseHistory where Field = 'Status'  ] ;
        For (Integer I = 0;CH.size() > I ; I++){
            If(CH[I].NewValue == 'Closed' && CH[I].OldValue == 'Open'){
            StatusChangedID.add (CH[I].Id);
            }
        }
       
        If(!StatusChangedID.IsEmpty()){
        // User StatusChangedID list as you requirment
        }