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:
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!
Feel free to share in the comments below any methods that you might have used to accomplish a similar requirement.