Is there any way to trigger the display of a page message in the embedding Detail page from the Controller Extension of a Custom list view button?

I create my list view buttons with this technique and as this uses seperate pages per button the page messages created in the Controller Extension seems to land in them and NOT in the displaying detail page.


<apex:page standardController="Contact" extensions="ContactAction_CtrlExt"   
           recordSetVar="contacts" action="{!doAction}">


Controller class

public with sharing class ContactAction_CtrlExt {


    public PageReference doAction() {
       ApexPages.addMessage( new ApexPages.Message(severity, 'THIS WILL NOT APPEAR IN PARENT PAGE') );
  • 3
    What is the page you want the Message displayed on? Is it the standard Contact page layout? If so, I don't think there's a way to do what you're after. You need a page where you can define what is on that page because the addMessage() function adds a message to the page calling that controller. In your case it's the button's page.
    – Nick Cook
    Nov 14, 2013 at 12:30
  • @NickCook:That's exactely what I am trying to do. Nov 14, 2013 at 13:08
  • Are you able to create a Visualforce page for the Contact layout instead of a standard page? If you do this you can customise the whole page, including any pageMessages you want to add to it.
    – Nick Cook
    Nov 14, 2013 at 13:52
  • Yes the contact page already has a custom page. How would you then implement it? The only thing I can come up with is passing the message via URL param. Not very elegant. Nov 14, 2013 at 13:55
  • Hi Robert, are you redirecting in your doAction function to another detail page? If so, this might be of interest, salesforce.stackexchange.com/questions/13430/…, but basically yes its a matter of marshalling your messages accross to the other page unless your other page reuses the same controller, could they share the same controller and thus state? In this case Visualforce runtime does not redirect simply changes the view / page. Nov 14, 2013 at 15:17


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.