You need to sign in to do that
Don't have an account?
How to handle edit page behavior from search results?
We have a custom object Account_Email__c as a child object of Account. In order to maintain summary data on the account record we override the standard New and Edit function for this object with a custom VF page controlled by an extension controller.
The extension controller uses the RetURL from the calling page to determine which Account record to use - this works well for the New and Edit functions called from the standard buttons on the Account Page, but it does not work when the user presses the Edit button presented on a standard search result that matches the AccountEmail Address (as the RetURL is not the Account record at all.)
Any suggestions on a way to determine the account record when it is not available on search as a retURL and there could be multiple matching search results?
Turned out there is a simple solution - use acctId = accountEmail.Account__c and as long as the field is on the Visualforce page (just use output field with rendered = false) then the account can be retrieved by selecting on acctId from new or edit, regardless of where the page is called from.
If user can search the Account_Email__c record, doesn't it mean it's already in the database?
And if it's a child object of Account, isn't it already have an Account reference?
If I'm not misunderstanding, you just query Account__r.RecordTypeId (assuming the Account field is Account__c) if retURL or id parameter is not in the URL.
ThomasTT