+ Start a Discussion
Sunila MSunila M 

Hide Action modal/pop-up window of Action button in lightning.

Hi All,

  I have created an Action with Action Type as 'Custom Visualforce' for a Custom object. Once I click on the the action button from my record details page the specified visualforce is invoked, which has an extension controller class that does my requirement. In my controller I am redirecting to specific URL based on some condition. I am able to see a pop up window even if I am redirecting the page to another URL/same record URL. How can I avoid this?

Is there any way to hide the pop-up window/action modal in case of redirecting the page?(I am not using Lightning component).
 
Veena GopalVeena Gopal
Hello Sunila,
Could you please put your code extract if possible?

Regards,
Veena.
Sunila MSunila M
Hi Veena,
Please find the code extract below;

My VF page;
<apex:page extensions="FeedbackButton" sidebar="false" showHeader="false" action="{!autoRun}" standardController="Feedback__c"> 

    <apex:messages/>
  
</apex:page>
Controller:
global class FeedbackButton {
    //Define the Project Object
    Feedback__c feedback = new Feedback__c();   
    String feedbackID; 
    String theAccountID;
       
    
    // Constructor - this only really matters if the autoRun function doesn't work right     
    public FeedbackButton(ApexPages.StandardController stdController) {        
        this.feedback = (Feedback__c)stdController.getRecord();     
        
    } 
    
    // Code invoked on page load.      
    public PageReference autoRun()
    {           
        String feedbackIdVal = ApexPages.currentPage().getParameters().get('id'); 
        
        if (feedbackIdVal == null) 
        {             
            // Display the Visualforce page's error message if no Id is passed over             
            return null;         
        }       
        
        Feedback__c feedbackRecord =new Feedback__C();
        if(Schema.sObjectType.Feedback__c.isQueryable()){
            Feedback__c feedback = [select Id, Account__c,Email__c,Mobile__c,Phone__c,Customer_Name__c from Feedback__c where id =:feedbackIdVal Limit 1];
            feedbackID = feedback.Id; 
            theAccountID = feedback.Account__c; 
            
            feedbackRecord = feedback;
            
            if(theAccountID!=null && theAccountID!=''){
                
                Account account = [Select id FROM Account WHERE Id =:theAccountID];
                redirectId=theAccountID;
                return new ApexPages.StandardController(account).view();                 
                
            }
            else{
				//my logic-------------
				
				return new ApexPages.StandardController(feedbackRecord).view();
            }             
        }
        return new ApexPages.StandardController(feedbackRecord).view();
    }
}



 
Sulabh KapoorSulabh Kapoor
Hi Sunila,

Did you get answer to your question? I am stuck at the same point where I want to hide the modal popup.

Thanks.