Displaying Messages At Record Header Level On Page Layouts Using Inline Visualforce

End users often want to be informed of vital information pertaining to a Salesforce record at the header level. If you need a warning or a simple informational message to stand out to the users, inline Visualforce can help you easily accomplish that.  Want to display a red message at the top of the Case detail page when a Case Priority is High and it’s still open? Want to display a Warning message at the top of the Opportunity detail page when it’s less than 7 days away from its Close Date? Want to display an informational message at the top of a Quote detail page after it’s approved? All of this can be done using a simple VF page which can then be placed inline at the top of a page layout.

Here is what the message looks like and you can obviously change the styling by modifying the CSS:

Example image

There isn’t much to explain so let’s get down to the fun part of implementing this:


In the last few lines of our code, we specify the conditions and content as per which the relevant message should be displayed. Before that, it’s all about styling of our content to be displayed.  Now the only thing left is to add this page as an inline Visualforce page to the appropriate page layout and then set the height and width to display the message.



See how  simple that was? We were able to add an inline VF page to a record detail page sans any Apex extension or custom controller or complex code logic. Save and test to see the magic!


Closed Won



Closed Lost

Feel free to share in the comments below any methods that you might have used to accomplish a similar requirement.

Source code:

  • Thanks Mayank for sharing this. I implement this for my Project milestone in lightning Experience to make Sales Team life easy. Take a look below image !!

    • Mayank

      Hey Pritam, that looks fantastic!

  • Hemanth

    i need same functionality when ever child records are inserting then i need to display message please help me how to achieve this….. Thanks


We're not around right now. But you can send us an email and we'll get back to you, asap.


© 2018 Succeed With Salesforce | Website by Tonevski.com

Log in with your credentials


Forgot your details?