How to display alert on Salesforce Standard/Custom object Page Layouts?
This post describes how to display alert on Standard or/custom page layouts based on specific field value. Here I am going to explain this scenario for Account Layout. If I open an account record where “Display_Alert__c” equals true, I need a pop to display.
To achieve this we need to create a visualforce to display popup. And place this visualforce page on page layout you want to display.
Fallow below steps to implement this solution.
- I have created a custom field on Account object with data type checkbox. Field name is “Display_Alert__c”
- Create a visualforce page “AccountAlertLayoutPage” to display alert. I created this page with below code.
- Next go to Account page Layout and add visualforce page created above to the Account PageLayout.
Setup -> Customize -> Account -> Page Layout
Click Edit next to the page layout and add visualforce. Click on visualforce settings change width & height to “0”. And also uncheck “show scrollbars & show labels”.
To test this Create an Account record with required fields and also check “Display_Alert__c” checkbox. Next open this record, you will get alert checkbox.
You can change popup message on visualforce page based on your requirement. You can implement this for any type of field based on your requirement. And you can implement your own visualforce based on your requirement.