We need to use ALL ROWS keyword in soql query.
ALL ROWS keywords need to be used to query all records in an organization, including deleted records( records in your organization's Recycle Bin) and archived activities.
You cannot use the ALL ROWS keywords with the FOR UPDATE keywords.
list<Account> listOfAccounts = [SELECT id,Name FROM Account WHERE isDeleted = true ALL ROWS];
undelete listOfAccounts ;
isDeleted:- It is a standard field of account used to differentiate whether account is in Recycle Bin or not.
undelete:- Its a DML Operation.
FOR UPDATE:Keywords used in SOQL to lock an sobject records and preventing from being updated.
P.S.:- ORDER BY and FOR UPDATE keywords in any SOQL can not be used together.
ALL ROWS keywords need to be used to query all records in an organization, including deleted records( records in your organization's Recycle Bin) and archived activities.
You cannot use the ALL ROWS keywords with the FOR UPDATE keywords.
list<Account> listOfAccounts = [SELECT id,Name FROM Account WHERE isDeleted = true ALL ROWS];
undelete listOfAccounts ;
isDeleted:- It is a standard field of account used to differentiate whether account is in Recycle Bin or not.
undelete:- Its a DML Operation.
FOR UPDATE:Keywords used in SOQL to lock an sobject records and preventing from being updated.
P.S.:- ORDER BY and FOR UPDATE keywords in any SOQL can not be used together.
No comments:
Post a Comment