Skip to main content
Ram Kolli (Private) ha fatto una domanda in #Customer Service
Hi,

 

I've a forumula field having hyperlink in a page layout ( because i need to display this link on only one record type). when I click on this hyper link, I am calling apex class which is a PageReference return type. In case of success scenario, it is navigating to a website. In case of failure, I was supposed to return to the same page layout with an error message. Since it is a standard page layout, I am not using visualforce in betwee. How to achieve this ?
1 risposta
  1. 13 giu 2018, 04:25
    If you want to send an error message from your controller, you need something like this:

     

    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR, 'my error msg'));

     

    Plus, you need to include <apex:pageMessages id="messages"/> on your Visualforce page and make sure you re-render it after your action runs.
0/9000