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
charlie_vcharlie_v 

Capture Account ID Before Navigating Away from Page?

Hi.  This is probably very basic, but I'm new to Apex and VF, and can't find this on the boards or documentation...

Our users will be accessing our new VF pages via a Custom Link on an Account's Detail Page.

The Apex class in the custom controller grabs the Account ID using the code:

Code:
where id = :ApexPages.currentPage().getParameters().get('id')];

But the problem is, when you click on the Custom Link on the Account Detail Page (and open VF page in existing window) the account id from the code above is no longer available.

How do I capture the account id prior to navigating away from the page?

ShamSham
use merge Fields to pass the ID around to the Visual Force as a queryString.
eg.

/apex/VFPage?Id={!Account.Id}