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
kishna 15kishna 15 

How to close lightning global action modal dialog

I have created one visual force page and calling in global action. while clicking global action button I am getting a model dialog box. How to close this popup window automatically in visualforce page

Thanks............
Raj VakatiRaj Vakati
You need to use publisher.close  

Refer this link 

https://developer.salesforce.com/docs/atlas.en-us.salesforce1.meta/salesforce1/vf_custom_action_about_the_code.htm
// Success - close the publisher and refresh the feed
Sfdc.canvas.publisher.publish({name: "publisher.close", 
    payload:{ refresh:"true"}});

 
kishna 15kishna 15
Still, I am not able to close the global action popup window. below VF I am calling through global action after clicking global action button in lightning it is showing one popup window I want to close popup window automatically 
 
<apex:page controller="contactQuery" action="{!fcontactQuery}" contentType="application/vnd.ms-excel#DataExport.xls" cache="true" showHeader="false">
    
    <apex:pageBlock >
        <apex:pageBlockTable value="{!contacts}" var="con">
            <apex:column value="{!con.id}"/>
            <apex:column value="{!con.firstname}"/>
            <apex:column value="{!con.lastname}"/>
            <apex:column value="{!con.phone}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
    <script>
    // Success - close the publisher and refresh the feed
    Sfdc.canvas.publisher.publish({name: "publisher.close", 
                                   payload:{ refresh:"true"}});
    </script>
    
</apex:page>
Raj VakatiRaj Vakati
can you give me controller also ?? 
kishna 15kishna 15
Hi Raj,

This is my controller class we are passing contact records to vf page and calling vf through global action.

public class contactQuery {
    public list<Contact> contacts{get;set;}
    public void fcontactQuery(){
        id accid=ApexPages.currentPage().getParameters().get('id');
        contacts=[select id,firstname,lastname,phone from contact where accountid=:accid];
    }
}

Thanks.............
Raj VakatiRaj Vakati
CAN U REPLACE THE CODE WITH JAVASCRIPT ? 
kishna 15kishna 15
Can you please suggest me how to replace code with java script