You need to sign in to do that
Don't have an account?
Mahesh Nirmal
Getting an A callout was unsuccessful error for Big Object
Hi,
I am having an Big Object on which I am quering the record from it and inserting the record to Account object and once the data is inserted in account object I am deleting the data from Big Object.
During this process for DML I am getting the below Error-
EXCEPTION_THROWN [95]|System.UnexpectedException: A callout was unsuccessful because of pending uncommitted work related to a process, flow, or Apex operation. Commit or roll back the work, and then try again.
Please assist on this.
Thanks
In Salesforce, a callout can not be made when there is uncommitted data pending (not committed to the database).
If the callout can occur before Database insert/update, then do the callout prior to those data operations.
Otherwise, ensure the callout will be run in a separate execution context.
Options to solve this:
Few more references:
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_future.htm
https://help.salesforce.com/articleView?id=000328873&type=1&mode=1
Hope above information helps. Please mark as Best Answer so that it can help others in future.
Thanks.
Hi Shivankur,
Thank you for your Reply.
We are trying that on big object and we are not having any callout in that.
You might need to separate the transaction mentioned above into two separate transaction, where you can query the data from Big object and insert the account records.
Once the account records is successfully created and first transaction is ended/finished then only you should start next transaction to query on Big object for the same data and delete it. This could be the probable root cause for this error since second operation is not being completed when there is pending work to be commited.
Hope above information helps. Please mark as Best Answer so that it can help others in future.
Thanks.
I was having the same problem today and your second answer solved it, I didn't know queries on Big Objects behaved like asynchronous operations.
Thanks.