[SalesForce] Case Custom Button Lightning to Update Status

I am trying to update case status field on lightning detail page. We are not using case feed. I think lightning components cannot be added on case and Work Order detail page.
FYI: Actions on Case object in Lightning

What is the best approach. when i try to add lightning button it shows on the case feed.But i need on detail page.
Only approach i can think of is
New Button or Link :URL or Visualforce Page Button
I tried both. On click of the button,
I need to update the status to "Completed".
User should not refresh to reflect the change. Right now with this approach i need to refresh the page few times to reflect the changes.

Can someone please help.Also please let me know if there is any other approach.
URL: /apex/UpdateCasePage?cid={!Case.Id}


<apex:page controller="CaseUpdStatus" action="{!updateCasestatus}">
    <apex:form >
        <apex:pageMessages ></apex:pageMessages>
    </apex:form> 
    <script type="text/javascript">
        function RefreshPrimaryTab() 
        {
                    window.close();
                  window.top.location.href = '/{!cid}' ;
        }
    </script>    
</apex:page>

Class:


public with sharing class CaseUpdStatus{
    public string cId {get;set;}
    // constructor
    public CaseUpdStatus(){
        cId = apexpages.currentpage().getparameters().get('cid');
    }
    public pagereference updateCasestatus(){        
        // getting case Record Details
        List<case> lstCase = [SELECT ID,
                                        RecordType.Name,
                                        status
                                    FROM case
                                    WHERE ID =:cId];
        system.debug('\n--lstCase--'+lstCase);
        if(!lstCase.isEmpty()){                           
                lstCase[0].status= 'Completed';
                update lstCase;
                pagereference page = new Pagereference('/'+cId);
                page.setRedirect(true);
                return page;                                      
        }
        return null;             
    }
} 

Best Answer

@VSDF,

Yes, quick actions appear on feed layout for case and work order object. To solve this problem follow below steps:

  1. Create custom component with the button as close case.

  2. Get the record Id, pass it to the lightning controller and close the case, you can use lightning data service too.

  3. On successful update you can fire $A.get("e.force:refreshView").fire(); to refresh the detail page without reloading the entire page.