Skip to main content
Amber Gillis (K2M) ha fatto una domanda in #Data Management
I need a LOT of guidance on this one- I'm modifying a VF page I didn't create and need to display a validation error message when the correct criteria is met.  Currently, when the criteria is met, the visualforce page redirects to a different url, giving users error messages not allowing them to proceed.

 

Any guidance would be extremely helpful!!  Thank- Amber
1 risposta
  1. 12 nov 2013, 05:42
    Case 1

     

    if you're visual force page is doing a DML, then you could put this tag on the top of vf , below the apex:page

     

    <apex:pageMessages id="errorMessage"/>

     

    then you can write a validation rule on the object with your criteria. 

     

    Case 2

     

    your VF has some logic that which evaluates to a an error ... and you need to display a message

     

    in your controller 

     

    public void myMethod()

     

    {

     

    // you're doing your logic

     

    ...

     

    if(somehing happens )

     

    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,  

     

                                    'Some very important message for the user')); 

     

    }}

     

    if our suggestion(s) worked,  let us know by marking the answer as "Best Answer" right under the comment.This will help the rest of the community should they have a similar issue in the future.  Thank you!

     

    Shiv
0/9000