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
lsateeshklsateeshk 

Page Messages

Hi , 

I have PageMessages in my controller how can i display that on a different page ;

 

I create a record and next Button actually inserts record in the object on the Next page it has a different Functionalities 

 

<apex:pageBlockButtons location="bottom" >
<apex:commandButton value="Approve" action="{!Approve}" style="width:20%"/>
</apex:pageBlockButtons>

 

 

controller

public pageReference Approve()
{
st.Status__c = 'Approved';
update st;
ApexPages.addMessage(new ApexPages.message(ApexPages.severity.CONFIRM, 'Record Has Been Approved'));
pageReference RecordsPage=new PageReference('/apex/QATRecordDetailPage?id='+st.QATApproval__c);
return RecordsPage;
}

 

how do i make this message Display on the pagereference page :;

 

 

Can some one help me out please 

 

 

Wonder WomanWonder Woman

Why don't you create the PageReference with the following URL:

 

pageReference RecordsPage=new PageReference('/apex/QATRecordDetailPage?id='+st.QATApproval__c+'&status=approved');

 

And read the parameter in the constructor and show the message if its value is 'approved'.

 

OR

 

Read the field Status__c for the object in the contructor of the next page and show this message only if it is 'Approved'.