0

I'm trying to lunch this VF page from an Object (Account) Quick Action but the Action is not showing in the layout so I´m not able to see the page.

editCases.vf

<apex:page standardController="Account"
           extensions="AccountsController"
           sidebar="false" tabStyle="Account" >
    
    <style>
        .dataCell input {
        width:100px;
        }
    </style>
    
    <apex:form >
        
        <apex:actionFunction status="outStatus"
                             name="yacks" rerender="table" />
        
        <apex:pageBlock title="Edit Cases"
                        mode="edit" id="table">
            
            <apex:pageBlockButtons >
                
                
                <apex:commandButton action="{!save}"
                                    value=" Save " />
                
                <apex:commandButton action="{!add}"
                                    value="Add"
                                    rerender="table" />
                
            </apex:pageBlockButtons>
            
            <apex:pageMessages />    
            
            <apex:pageBlockSection
                                   title="Account Name : {!Account.name} "
                                   columns="1">
                
                <apex:pageBlockTable
                                     value="{!caseItems}"
                                     var="item"  >
                    
                    <apex:column
                                 headerValue="Action">
                        
                        <apex:commandLink
                                          value="Del"
                                          action="{!del}"
                                          rerender="table" >
                            
                            <apex:param
                                        name="delname"
                                        value="{!item.CaseNumber}" />
                            
                        </apex:commandLink>
                        
                    </apex:column>
                    
                    <apex:column
                                 headerValue="Case Number">
                        
                        <a href="/{!item.CaseNumber}">
                            {!item.CaseNumber}</a>
                        
                        <apex:outputPanel
                                          rendered="{!isnull(item.CaseNumber)}" >
                            
                            <apex:inputField
                                             required="true"
                                             value="{!item.CaseNumber}"
                                             onchange="yacks();" />
                            
                        </apex:outputPanel>
                        
                    </apex:column>
                    
                    <apex:column
                                 headerValue="Subject">
                        
                        <apex:inputField
                                         required="true"
                                         value="{!item.Subject}"
                                         onchange="yacks();"/>
                        
                    </apex:column>
                    
                    <apex:column
                                 headerValue="Reason" >
                        
                        <apex:inputField
                                         required="true"
                                         value="{!item.Reason}"
                                         onchange="yacks();" />
                        
                    </apex:column>
                    
                    <apex:column
                                 headerValue="Origin" >
                        
                        <apex:inputField
                                         value="{!item.Origin}"
                                         onchange="yacks();"/>
                        
                    </apex:column>
                    
                </apex:pageBlockTable>
                
            </apex:pageBlockSection>
            
        </apex:pageBlock>
        
    </apex:form>
    
</apex:page>

AccountController.apxc

public with sharing class AccountsController {
    
    /* I set the Account and Case Objects
    here for use through out the code*/
    
    public Account acct { get; private set;}
    public Case[] caseItems { get; private set; }
    private ApexPages.StandardController controller;
    
    // constructor, loads the Account and
    // any cases associated with it
    
    void caseItems(id id) {
        acct = [SELECT Id, Name, Type, AccountNumber, Site,
                (SELECT Id, CaseNumber, Status, Reason,Origin,
                 Subject FROM Cases) FROM Account
                where id = :id limit 1];
        //Hook caseItems to the query above
        caseItems = acct.Cases;
    }
    
    //Define the id
    id accountid;
    
    /* A List Method to delete the Cases assigned*/
    public List<Case> todelete = new List<Case>();
    
    public AccountsController (ApexPages.StandardController c)
    {
        /* this will kickoff you main page */
        controller = c;
        /* to get this current Account Id*/
        accountid = c.getRecord().id;
        /*kick off the init() function*/
        init();
    }
    
    public AccountsController () {
        accountid =
            ApexPages.CurrentPage().getParameters().get('id');
        
        init();
        
    }
    
    void init() {
                /* load up Cases
                    basically we defined caseitems up on top, so
                    when the page loads then caseItems(accountId)
                    will go through the query and list out the
                    Items assoicated with it */
        caseItems(accountid);  
    }
    
    public PageReference save() {
        try {
            upsert caseItems;
            if ( todelete.size() > 0 ) {           
                delete todelete;   
            }
            caseItems(acct.id);
        }
        catch ( DmlException exc) {
            ApexPages.addMessages(exc);
            return null;
        }
        return null;
    }
    
    
    /* your Delete functionality*/
    public PageReference del() {
        
        string delname = ApexPages.CurrentPage().getParameters().get('delname');
        system.assert( delname != null );
        integer gone = -1;
        integer i = 0;
        
        for ( i=0; i< caseItems.size(); i++ ) {
            if (caseItems[i].CaseNumber== delname) {
                gone = i;
            }
        }
        if ( gone >= 0) {
            todelete.add(caseItems.remove(gone) );
        }
        return null;
    }
    
    public PageReference add() {
        // insert a new line, after user clicks Add
        Case cs =  new Case(
            AccountId = acct.id,
            Subject = 'hello', Status = 'Low',
            Reason = 'Other',Origin='Low'
        );
        caseItems.add ( cs );
        return null;
    }
}

I've created the Quick Action in the Account Object:

enter image description here

and then added the Quick Action (Call VF) to the Account Layout but the Action is not showing :/

enter image description here

Account Layout where the action should appear for launching the VF page

enter image description here

Any idea why this could be happening ? Thanks a lot for reading

1 Answer 1

1

To make the quick action visible in Lightning, you'll also need to add it to "Salesforce Mobile and Lightning Experience Actions".

Adding some screenshots to make it easier for you

enter image description here

As you can see in the above image, I added this button under the Lightning actions.

enter image description here

And then it's available under actions on the Account lightning page.

1
  • Thank you, I missed that one ... I tried to add it to the lightning area but it wasn´t letting me, then I realized how it was made, thanks a lot for the answer Commented Nov 25, 2020 at 15:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .