0

How can I display an error message in a Page Layout, not in Visualforce?

  • 3
    If you write any validation rule it will display the error message, you will have an option to display the error message at field level or at the top of the page. If this is what you are looking elaborate your question. – Suresh Apr 15 '15 at 19:23
  • What is causing the error? – pchittum Apr 15 '15 at 23:11
1

If you want to do it through triggers: - https://help.salesforce.com/apex/HTViewSolution?id=000176551&language=en_US If you want to do it through validation rules - http://www.salesforce.com/us/developer/docs/workbook/Content/validation_2.htm

1
if(errorLogic())
{
    ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Error Message Text Here'));
    return null;
}
  • The original question was asking to do this on a Page Layout and not Visualforce, your solution will only work with a Visualforce page. – Alex Tennant Apr 17 '15 at 8:23
  • @AlexTennant I was simply agreeing with Anandmagesh 's post that it is possible to throw an error message with a (before insert) trigger. I was just trying to provide some sample syntax of what that trigger might look like. This solution does not require a VF page but understand if this solution is not helpful due to the fact it will require code. If you want to setup an error message declaratively on a page layout I would recommend Validation Rules – Connor Ross Apr 22 '15 at 1:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.