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
Azeez ThummalapalliAzeez Thummalapalli 

Unable to perform DML in Continuation Callback method when calling from Lightning Component

I am trying to use Continuation concept for making Asynchronous webservice call from Lightning Component. 

As per the syntax given in documentation,  I have annotated the continution method with 
@AuraEnabled(continuation=true)


and callback method as just 
@AuraEnabled


When trying to execute this from UI, I am getting the below error message:
Error message: Apex methods that are to be cached must be marked as @AuraEnabled(cacheable=true)


If I add 'cacheable=true' to callback method, then I am unable to perform DML opeartion in it. Ideally, after completing webservice call we must be able to perofrm DMLs, and this works in VFpage but not in Lightning Component. 

Could you please suggest any solution or workaround. Thank you in advance.
 
Azeez ThummalapalliAzeez Thummalapalli
As a workaround, create a separate Apex method to perform DMLs and invoke that from Javascript method from which the continuation call is originated/initiated.