I have an apex class mySenderClass with public {get;set;} variables that store values such as subject and HTML Body that I use in a Messaging.sendEmail method.

Users open multiple tabs of the same VFP (Visualforce Page) and Apex class to work multiple items at once.

For about 10 emails a day out of about 1000, the subject and body of the email are blank and there are reports of working on one email but the values that are sent are the values on another tab.

There are various checks on the front end that ensures those values have content before getting to the sendEmail method, but it would appears as if one tab is updating the variables in another. Combination getting defaults of apex class, updating on VFP, and sending back to update variable in apex class through an apex function.

Is it in anyway possible for me to open two tabs of the same VFP and the updates to the one VFP and Apex Class are making their way to the other visualforce page / apex class tab?

Is it possible for jQuery to traverse multiple tabs in Saleforce? I would think not since each console tab is technically an iframe so accessing other variables would not be possible, and I couldn't replicate this even watching the JS variables in the browser.

Is there a certain amount of time or user action (other than refreshing) to where an apex class may lose it's state of variable values? I would think not as I left a page open for four hours and it persisted it's variable state.

1 Answer 1


In Visualforce, each page loaded has a View State. This is persisted in the browser, and not on the server. As such, the apex class cannot "lose its state" in that sense.

Also, it is not ordinarily possible for state to cross over from one instance of a page to another. However, if you are using certain features, like localStorage, it is possible for multiple copies of a page to share data.

<apex:page >
    window.addEventListener('storage', (e) => {
        document.querySelector('#info').value = e.newValue;
    function store(event) {
        localStorage.setItem('value', event.target.value);
    <input id="info" onchange="store(event)" />

Open this page in two tabs to see it in action.

In addition, the sforce.one library includes methods for communicating between tabs, as long as they're within the same browser and session. The new Lightning Message Service also acts as a proxy between Visualforce and Lightning Components. Finally, in Visualforce, you can also use a service worker to communicate across tabs.

In summary, then, whatever is going on is at least technically possible. Without a review of the code, though, there's no way to know for certain. It could just be a training issue, etc. Note that this isn't really "accidentally" possible; the developer must make a conscious decision to share data across tabs. Nothing in jQuery would naturally share data this way.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .