+ Start a Discussion
Ankit Singh 6Ankit Singh 6 

Data not updating on page refresh in opportunity

I have added a trigger on opportunity, which on processing data updates the value in a custom field. Trigger runs asynchronously and the field updatation is taking time. My assumption is that, on clicking save button in opportunity, it fires a trigger and side by side saves the data. As trigger is taking some time for processing, the data gets saved first and refreshes the page. The trigger changes are not yet saved and hence not reflected. If i refresh the page after some time, then the trigger changes are also reflected correctly. Can you please provide me a solution for this scenario?
Andy BoettcherAndy Boettcher
If your code is running asynchronously, it will not save at the same time your record saves - it will be run as system resources are available AFTER your transaction has completed.

If you want to see immediate results on a record save - you will need to run your code synchronously.