[SalesForce] How to display warning message on screen if we are changing default value of field

On Opportunity Object,There are 2 fields Stage and Probability which are linked to each other.As we changed the stage,it changes the probability value.
Users having edit permission on Probability field can add manual value in Probability field but if we are adding manual value instead of default one,
is there any way to display a warning message on screen before?

The warning message is only for users convinence as they are adding their own value instead of default one.

Best Answer

Here is vf page

<apex:page standardController="Opportunity" rendered="{!Opportunity.StageName == 'Proposal'}">
 <script type="text/javascript">
  { window.alert("Your message here"); }
 </script>
</apex:page>

Go to opportunity and edit opportunity page layout. Drag this new visualforce page on page layout. Edit the visualforce page properties and set Height as 0 pixel. (We don't need to show this page to users.) Save the page layout.

Related Topic