function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to display message

I have created one custom object & there is one picklist Opt with two option- Yes & No.


My requirement is that I want to display  “I like primary interest specifically secondary interest” if user selects ‘YES’ option in picklist.



If you are trying to display this alternative text on the detail page itself a good idea could be creating a formula field which would show the alternative text based on the option chosen by the user.



Grazitti InteractiveGrazitti Interactive



To achieve the requirement there are two ways-


1. if you dont want customization, then create formula field with return type text   as follow -


If( TEXT(API Name of picklist field )=="yes","I like primary interest specifically secondary interest","")


2. if you want customization ( apply css on text of message) then use inline visualforce page as follow


<apex:page standardController="API Name of object">

/***I am taking Account for example

<apex:page standardController="account">
    <apex:outputText styleClass="message" rendered="{account.API NAME OF PICKLIST FIELD=='yes'}" value="I like     primary interest specifically secondary interest"></apex:outputText>



Add this VF page in the layout of that object.




Hi Grazitti & Auyon
Thanks for your reply but according to my requirment I am suppose to write trigger to to display message once I selects 'Yes' option in picklist.

Hey Prakhar, 


If you need to write a trigger to show a message, then create a custom label and use it on Trigger, 


I have writter blog on showing message on Standard Page using Label


take a llok at it, hope this helps