FOR UPDATE AFAIK is a "pessimistic" (i.e lock before you do anything) type of locking. So another user that's trying to update the same record might receive an error.
You can specifically lock a set of records in a result set by adding the keywords for an update to a SOQL query. This approach protects the integrity of your data, but can also cause other processes to wait until the locking transaction completes, so carefully consider the use of these options.
Hi @samar
Can you please send your SOQL query?
Thanks,
Hi Samar
FOR UPDATE AFAIK is a "pessimistic" (i.e lock before you do anything) type of locking. So another user that's trying to update the same record might receive an error.
You can specifically lock a set of records in a result set by adding the keywords for an update
to a SOQL query. This approach protects the integrity of your data, but can also cause other
processes to wait until the locking transaction completes, so carefully consider the use of these
options.
Please send your query.
Thanks,
Query is like
List<customObject__c> listRecords = [Select ID, Name, Date from customObject__c Order By Date]
Here if you see I have Order By clause in query but it didnt work with FOR UPDATE keyword, but requirement is to keep order intact.
Any idea?