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
D_M_CD_M_C 

Modify current object via Visualforce component on standard object layout (in real-time)

Is it possible to modify/update the currently-viewed object via a Visualforce page on a standard object's layout in "real-time"?

 

Example: I have a small Visualforce component on my Account page layout.  When I interact with the Visualforce component (which has an Apex controller to save changes to the Account object), I would like those changes to be reflected on the non-VF items on the page without a page refresh.  In my case, I just need a check-box to be flipped depending on what happened within the VF component.  Is this possible?

 

sfdcfoxsfdcfox
You could use an HTML5 message to attempt to refresh the parent page and/or manipulate the parent page's properties. Modifying a checkbox might not be terribly bad, but for more complex interactions, I'd probably suggest simply refreshing the page.

Note that HTML5 messages are not supported on IE7, but should work well elsewhere (including IE8+). See "window.postMessage" anywhere on your favorite search engine for specifics on this mechanism.

Basically, you'll add a Home Page Component with a script that performs the desired action when a message is received via JavaScript, and include that component on all pages via Setup > Customize > User Interface. Then, you'll send the message from your VF page using window.parent.postMessage(...).