I have to do a callout, but before doing the callout I need to update the cases and use the values from the cases' fields in the request body and then do the callout. I cannot do DML before callout. Trying to do future/Queueable on update of cases still led me to You have uncommitted work pending. So I have to do future/Queueable on the callout. But my callout logic has return statements while future/Queueable return void.
The only solution I found out was:
- assigning new values to the cases' fields without calling update
- use them as request body
- get response from callout
- update cases
- continue with callout logic
Is there a way to return from future/Queueable?