+ Start a Discussion
RoyalRoyal 

difference IsDeleted= true and ALL Rows in salesforce SOQL

these two means same like isdelete= true  and ALL Rows , both are used for to get the records from recycle bin,

so my question is what is exact specific reason where eatc used ?

Thanks
ManojjenaManojjena
Hi Boyapati,

IsDeleted is a standrad field in object in salesforce . All Rows Literal which says to query all records including recycle bin .

If in the query you have given condition like isDeleted= true then it will only pull the record from recyclebin .

You can check in workbench axecute ananumous section which will help you to clear your doubts .

Step1-Delete on eaccount and check below code .
 
List<Account> accList=[SELECT Id FROM Account ALL ROWS];
System.debug('************************'+accList.size());
 
List<Account> accList=[SELECT Id FROM Account ];
System.debug('*************'+acclIst.size());
List<Account> accList=[SELECT Id FROM Account  WHERE isDeleted = true ALL ROWS];
System.debug('*************'+accList.size());

https://workbench.developerforce.com/login.php

Give your credetial of your devloper org and select production .

Check the trem and contion and login .

User-added image


In the drop down select apex execute and paste all different code and test you will claer the concept .

Any issue please let me know .

Thnaks 
Manoj
RoyalRoyal
Hi Manoj,

thanks
After i run i got to know, below things. 
All ROWS = existing reords in Object  + existing records in recycle bin + allready expiry records in recycle bin(which is deleted from first).
IsDeleted= true  ALL ROWS = existing records in recycle bin + existing records in object.

thanks for replay.
 
ManojjenaManojjena
Hi Boyapati,

I am sure about the the record which is deleted from Recycle bin .The record which is deleted from recycle bin ha sno existance means it is permanantly deleted from the system .

Once it is permanently deleted how query is refer those records .

ALL Rows means all records in object +recycle bin .

If you will add condition isDeleted =true and ALL Rows means only th erecycle bin records .

I think you are clear now .

Thnaks 
Manoj