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>
    <script type="text/javascript">
        function RefreshPrimaryTab() 
                  window.top.location.href = '/{!cid}' ;


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,
                                    FROM case
                                    WHERE ID =:cId];
                lstCase[0].status= 'Completed';
                update lstCase;
                pagereference page = new Pagereference('/'+cId);
                return page;                                      
        return null;             
  • I tried this vfpage and controller to do this. Values are not refreshing
    – VSFDC
    Commented Nov 10, 2017 at 21:51
  • Can you edit the code of the page and controller into your question?
    – JaredT
    Commented Nov 10, 2017 at 21:53
  • the <script> tags and what is between are completely unnecessary; the VF pageaction method will redirect to the Case detail page if successful ; if an error, you should use ApexPage.addMessage(...) to get the error to appear
    – cropredy
    Commented Nov 10, 2017 at 23:32

1 Answer 1



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.

  • When you add button with Lightning Component behind on case is not displaying on layout
    – VSFDC
    Commented Nov 14, 2017 at 21:37
  • @VSFDC What do you mean by behind the case. You should add the new component which will have some buttons on the lightning app builder record page itself. Commented Nov 16, 2017 at 8:20

You must log in to answer this question.

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