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
John IssaJohn Issa 

Triggering a pop up message when clicking on the Convert button

Hello,

Is it possible to trigger a pop-up when a user selects the convert button on the lead object?

When converting, we have some criteria in the lead that will dictate what record type the lead will convert to in the account object. 

My goal is to provide a pop-up, like a YesNo messagebox that will allow them to proceed to the Convert screen if Yes is selected and end the operation if No is selected.  

Any guidance would be greatly appreciated.

Thank you!
 
Deepali KulshresthaDeepali Kulshrestha
Hi John,

I went through your requirement, Hope This Code will Help you:

1.VF Page:
<apex:page controller="communitycontroller">
    <style type="text/css">
        .customPopup {
        
        background-color: white;
        border-style: solid;
        border-width: 2px;
        left: 20%;
        padding: 10px;
        position: absolute;
        z-index: 9999;
        width: 300px;
        height:100px;
        top: 20%;
        }
        
    </style>
    
    <apex:form id="thefrm">
        <apex:pageBlock id="theblock">
            
            <apex:outputPanel id="showPopUp" >
                <apex:outputPanel styleClass="customPopup" layout="block" rendered="{!Flag}">
                    <b> Do you Want to convert Lead</b>
                    <br/>
                    <apex:commandButton value="Yes"/>
                    <apex:commandButton value="No"/>
                </apex:outputPanel>
            </apex:outputPanel>
            
            <apex:pageBlockSection columns="1">
                
                <apex:commandButton value="Open PopUp" action="{!check}" reRender="showPopUp" />
            </apex:pageBlockSection>
            
        </apex:pageBlock>
        
    </apex:form>
</apex:page>


2.Apex controller
 
public class communitycontroller
{
    public Boolean Flag{get;set;}
    public communitycontroller()
    {
        Flag=false;
    }
    
    public  void check()
    {
      flag=true;
    }
}


Note-->
{
 You can replace (OpenPopUp) button by your lead convert button,
 and corresponding you can add the actions as per your requirement in the (Yes and No)
 Buttons
}

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.

Thanks and Regards,
Deepali Kulshrestha
www.kdeepali.com