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
davidesidavidesi 

Add error message into the opener window

Hi to all.

I need to add an error message to a opener window. I explain it:

 

In opportunity page I have a buton wich open one window.  That window has a search functionality.

I need that if code throws an exception, it be shown in the opportunity window, not in the search one.

 

Could you help me in how doing it?

 

Thanks in advance

Best Answer chosen by Admin (Salesforce Developers) 
davidesidavidesi

I got the solution!

 

I needed to add an Id in <Apex:pageMessages id='error' /> , and specify to rerender that div in the button with the code rerender="error".

 

 

All Answers

Dev@Force.ax647Dev@Force.ax647

You can create a visualforce page and add error message on that.

Next when you get exception on search window, use javascript and set window.parent.location=apex/errorpage?showErrorNumber=777

davidesidavidesi

I am having troubles with that apparantly simple thing.

 

I have done following steps:

1º In the try-catch clause , I have added the following code:

 ApexPages.Message myMsg = new ApexPages.Message(ApexPages.Severity.INFO,Label.PlsEnterData);
            ApexPages.addMessage(myMsg);

2º In the VF page , I have added the VF tag 

<Apex:pageMessages />

 

 

And it’s not working.

Do you know why?

davidesidavidesi

I got the solution!

 

I needed to add an Id in <Apex:pageMessages id='error' /> , and specify to rerender that div in the button with the code rerender="error".

 

 

This was selected as the best answer