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
Pr@kh@RPr@kh@R 

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.

 

AuyonAuyon

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

Hi,

 

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:form>
    <apex:outputText styleClass="message" rendered="{account.API NAME OF PICKLIST FIELD=='yes'}" value="I like     primary interest specifically secondary interest"></apex:outputText>
  </apex:form>

</apex:page>

</apex:page>

Add this VF page in the layout of that object.

 

 

Thanks,

www.grazitti.com

Pr@kh@RPr@kh@R
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.
Abhi_TripathiAbhi_Tripathi

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

 

http://abhithetechknight.blogspot.in/2013/09/custom-error-message-on-standard-edit.html

 

take a llok at it, hope this helps