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
Scott.MScott.M 

Force Database Commit

Does anyone know if there's a way to force a commit during a transaction. The reason I need this is I have a method that inserts data into a custom object and I want to call getContent on a visualforce page to get some information based on the object just inserted. The problem is that the content isn't actually there yet becasue it doesn't get commited till the end of the transaction so in the getContent transaction the data doesn't exist : ( . How can I force this a commit? Also keep in mind that getContent() is not allowed in async or batch apex so those aren't an option.

 

Thanks!

Scott

XhitmanXhitman

Based on my previous research, we have no way to force a database commit. 

 

I just had to do some workaround in order to get the content to generate a PDF by having the getContent in a seperate button thus adding another step for the user.

 

Hope Salesforce could implement something like this soon.