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
Shirley MaglioShirley Maglio 

How to call the overridden Delete button in the Related List, so that it will get called instead of the standard Salesforce Delete on the Account detail page (displayed with the nooverride=1" parameter)?

Hi All,

I have overriden the standard "View" of the Account detail page with a custom Visualfroce page.  When I need to display the Account detail page, I use the "nooverride=1" parameter to display it and bypass the override.

I have also overridden Salesforce’s standard Delete button in a Related List of the Account detail page, by creating a second Visualforce page with an Apex controller extension class.

The problem I am having is, when I clicked the overridden Delete button in the Related List, the second Visualforce page is never called.  The standard Salesforce Delete was called instead.  I think this is happening because the Account Detail page was displayed with the nooverride=1" parameter.  Thus, no overrides were allowed.

Can someone give me some pointers as to how to call the overridden Delete button in the Related List, so that it will get called instead of the standard Salesforce Delete on the Account detail page (displayed with the nooverride=1" parameter)?

Any help would be greatly appreciated!

Shirley
kevin lamkevin lam
Which related list are you referring to? A standard related list doesn't have the Delete button, only a "Del" link next to each related record and that link doesn't have the "nooverride=1" parameter. Is that Delete button a custom button?
Shirley MaglioShirley Maglio
Hi Kevin,

I created a custom object called "Special Notes", and this custom object has a look up field to Account object.  The "Special Notes" is added as a related list on the Account detail page layout.  

Yes, I was talking about overriding the "Del" link on the related list.

I was saying the Account detail page was called and displayed with the "nooverride=1" parameter in the URL.

Shirley
 
kevin lamkevin lam
Hi Shirley,

I just tried overrideing the Delete function of Contact and a custom object in one of my sandboxes, then displayed an Account record with "nooverride=1" and got the visualforce page as expected (after the "Are you sure?" popup), not sure why it's not working for you.

Thanks,
Kevin.
Shirley MaglioShirley Maglio
The "nooverride=1" is the only way to get to my Account detail page.  Without the "nooverride=1", a custom Visualforce page is displayed instead (this is my first custom Visualforce page).  

When I clicked on a link for an Account record (without "nooverride=1"), the first custom Visualforce page is displayed with summary tables and charts.  To bypass this Vf page to display the actual Account detail page, a link with "nooverride=1" is accessed.  This is the condition I am working with now.

The overridden Del link on the Related List is supposed to go to my second Visualforce page, except it's defaulting to standard Salesforce delete.


 
kevin lamkevin lam
Sorry, didn't make it clearer in my previous response.

I opened the Account record with the "nooverride=1" parameter, then clicked on the "Del" link of either the Contact or the custom object related list and got the visualforce pages (equivalent to your second visualforce page) used for overridding the Delete function of Contact or the custom object.
Shirley MaglioShirley Maglio
Hi Kevin, Are you overrding the Account detail page with a different Vf page?  That is what I am doing.  I have two overriding Vf pages.  One is for Account detail page and the other is for the Del link on the Related List of the Account detail page.  I think to reproduce my problem, you will need to have these two overrding Vf pages in place.  ~Shirley
kevin lamkevin lam
This is what I have done:
  1. Create a VF page with StandardController set to Account and an outputLink set to "/{!Account.Id}?nooverride=1".
  2. Override View function of Account with the VF page above.
  3. Create a second VF page with StandardController set to a custom object.
  4. Override Delete function of that custom object with the second VF page.
  5. Open an Account record, get the overridden view, then click on the link to get the standard Account detail page.
  6. Scroll down to the related list of the custom object and click on the Del link of one of the related records and get the second VF page.