Activity Forums Salesforce® Discussions How do you lock the records from being edited by others in SOQL?

  • Anjali

    Member
    December 16, 2020 at 2:36 pm

    To lock a set of sObject records in Apex, embed the keywords FOR UPDATE after any inline SOQL statement. For example, the following statement, in addition to querying for two accounts, also locks the accounts that are returned: Account [] accts = [SELECT Id FROM Account LIMIT 2 FOR UPDATE];

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos