function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Taylor YoungTaylor Young 

Record Locking in Future vs. Queueable Apex

I have an upload handling class that parses the information, finds the relevant objects, and updates them. After that occurs I pass the records to a class that creates Tasks depending on the values of certain fields. 

As is, the Task creating class is Queueable Apex. But I can’t add the object id to the WhatId field of the Task because of record locking. Do you know any way to work around this? I have tried adding 'FOR UPDATE' to the initial query as suggested here: https://developer.salesforce.com/forums/?id=9060G000000I2r1QAC

Thank you!
AbhishekAbhishek (Salesforce Developers) 
Taylor,

Your query is answered here,

https://www.emizentech.com/blog/future-vs-queueable-apex.html


For further reference check this too,

https://www.apexhours.com/future-vs-queueable-apex/


Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.
Sandip rajbharSandip rajbhar
When we need to do a web service callout after the DML operation (https://www.thetrend24.com/)