Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Apex Code Development
- :
- Database update takes long to show in GUI
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Database update takes long to show in GUI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-14-2012 07:39 AM
Hi,
I have a custom object called Reservation__c that has a picklist Status__c.
I've created a custom button from the detail page that opens a new window to a custom VF page, where the user can change attributes of Reservation__c. On that page, the user can click Save, which does APEX update to the relevant Reservation__c object and window.top.close() to return to the Reservation__c detail page. Once the window is closed, I do a JS refresh of the Reservation__c page to show the changes of the object.
The problem is that it takes a few seconds for the change of Status__c to be seen in the Reservation__c page. I suspect that this is due to a delay in the database write backlog. If I wait 2-3 seconds and then manually refresh, the correct changes can be seen.
Any idea on how to solve this issue? I want the changes to be shown after the automatic refresh, and I want this automatic refresh to be done as soon as the database is updated.
Thanks
Solved! Go to Solution.
Re: Database update takes long to show in GUI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-14-2012 09:17 AM
It should be available "immediately" unless you're using @future methods (which are still generally immediate). Are you calling window.top.close() on submit on on complete? Once the page is fully rerendered, the data should be immediately available. If you're closing/refreshing "on submit", then the transaction is still running by the time the page reloads. Any synchronous calls are fully committed when they return. In fact, we have code like this in our project, and it works beautifully. Here's the basic idea:
<!-- CloseRefresh.page -->
<apex:page>
<script>
window.top.opener.refresh();
window.top.close();
</script>
<!-- OtherPage.page -->
<apex:page controller="xyz">
<apex:form>
<apex:commandButton value="Save/Close" action="{!saveClose}"/>
<!-- more form stuff here, etc -->
</apex:form>
</apex:page>
// xyz.cls
public with sharing class xyz {
public PageReference saveClose() {
// Save, and if all is well, return:
return Page.CloseRefresh;
}
}
If you follow this design, the commits will be visible by the time the window closes.
~ sfdcfox ~
I am a sandwich. That is all.
Re: Database update takes long to show in GUI
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
12-14-2012 09:30 AM
I was actually using onclick instead of oncomplete.... Thanks!!

