You need to sign in to do that
Don't have an account?
umutdogan
And it is redirecting to this page:
Is there a way to do this and could you write me some examples.
Thanks,
Umut
Sending Messages Over Pages
Hi,
I have apex classes to make some logic. There are exception handlers and if/else blocks to catch errors and redirect to a page based on an error. Examples:
... else { PageReference errorPage = Page.Error__c; errorPage.setRedirect(true); return errorPage; } ...
And it is redirecting to this page:
<apex:page >
<h1>Error occured</h1>
Error occured
</apex:page>
I want errorPage to attach error message to the redirect and it should be displayed when Error Page is opened.
Is there a way to do this and could you write me some examples.
Thanks,
Umut
The best way would be to add a parameter to your page and show that message on your error page, for example:
PageReference errorPage = Page.Error; errorPage.getParameters().put('msg', 'Failed to Save Record');
(Make sure to UrlEncode whatever message you're adding into the page parameter map)
All Answers
The best way would be to add a parameter to your page and show that message on your error page, for example:
PageReference errorPage = Page.Error; errorPage.getParameters().put('msg', 'Failed to Save Record');
(Make sure to UrlEncode whatever message you're adding into the page parameter map)
Thank you XactiumBen.
It solved my problem.
I want to ask one more thing.
Is there a way to test if a site is added to the Remote Site Settings or not. Before installation of the application I want to test if the Remote Site Settings are configured and if not i want to warn the user to add new remote sites.
Thanks,
Umut
Hello,
I went through your post...i too want to pass the error message to a respective error page.
Here is my code which i have tried:
catch(Exception ex){
PageReference errorPage = Page.Error;errorPage.getParameters().put('msg', 'Failed to Save Record');}
i have also created an apex param...but i am unable to solve the issue please help me out......