+ Start a Discussion

alert message on standard page


   In case object we have a picklist "type" I want to display a alert message when user selects picklist "Enhancement" or "Issue" as value please suggest me how to implement this on salesforce standard page. 

Khan AnasKhan Anas (Salesforce Developers) 
Hi Sudhir,

Greetings to you!

You need to create a visualforce page to edit Case. Then, override standard Edit button with visualforce page.
I have implemented the same functionality on the Opportunity object.

<apex:page standardController="Opportunity" extensions="OpportunityEditPageC" sidebar="false">
    <apex:form >
        <apex:outputPanel id="tstpopup">
            <apex:outputPanel styleClass="popupBackground" layout="block" rendered="{!displayPopUp}" />
            <apex:outputPanel styleClass="custPopup" layout="block" rendered="{!displayPopUp}" >
                <p> You have selected Warm Rating !!! </p>
                <apex:commandButton value="Ok" action="{!closePopup}" reRender="tstpopup" />
        <apex:pageBlock title="Opportunity Detail">
            <apex:pageBlockbuttons >
                <apex:commandButton value="Save" action="{!save}"/>
            <apex:pageBlockSection title="Opportunity Information 1" columns="2" collapsible="false">
                <apex:outputField value="{!accnt.OwnerId}" />
                <apex:inputField value="{!accnt.Name}"/>
                <apex:inputField value="{!accnt.Account.Name}"/>
                <apex:inputField value="{!accnt.DeliveryInstallationStatus__c}"/>
                <apex:inputField value="{!accnt.TrackingNumber__c}"/>
                <apex:inputField value="{!accnt.CloseDate}"/>
            <apex:pageBlockSection title="Opportunity Information 2" columns="2" collapsible="false">
                <apex:inputField value="{!accnt.Description}"/>
                <apex:inputField value="{!accnt.LeadSource}"/>
                <apex:inputField value="{!accnt.NextStep}"/>
                <apex:inputField value="{!accnt.Type}"/>
                <apex:inputField value="{!accnt.StageName}">
                    <apex:actionSupport action="{!showPopup}" event="onchange" reRender="tstpopup">
                        <apex:param name="accid" value="{!accnt.id}" assignTo="{!accid}"/>
    <style type="text/css">
        background-color: white;
        border-width: 2px;
        border-style: solid;
        z-index: 9999;
        left: 50%;
        position: absolute;
        width: 500px;
        margin-left: -250px;
        opacity: 0.20;
        filter: alpha(opacity = 20);
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        z-index: 9998;

public class OpportunityEditPageC {

    public Opportunity accnt {get;set;}
    public Boolean displayPopup {get; set;}
    public String accid {get;set;}
    public String oid;
    public OpportunityEditPageC(ApexPages.StandardController controller) {
        Opportunity temp = (Opportunity)controller.getRecord();
        oid = temp.Id;
        accnt = [SELECT Id, OwnerId, Name, StageName, Account.Name, DeliveryInstallationStatus__c, TrackingNumber__c, CloseDate, Description, LeadSource, NextStep, Type 
                 FROM Opportunity 
                 WHERE Id=:oid];
    public void closePopup() {
        displayPopup = false;
    public void showPopup() {
        //for(Opportunity ac : accnt) {
            if (accnt.Id == accid) {
                    displayPopup = true;

Override Standard Edit Button:
User-added image

User-added image

User-added image

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas