2

I am trying to create a button on Case to set the Status to Closed Case, however the button is not appearing on the Case Page Layout and I am not sure why.

I dont see that when creating a Lighting Web Component Quick Action there is anything that actually ties the code to a specific object when creating the Quick Action. To clarify I created the below quick action on Opportunity as well as Case. It oddly enough shows on Opportunity but does not show on Case? Is this some odd Limitation to the platform?

JS

import { LightningElement , api} from 'lwc';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
import {  getRecordNotifyChange } from 'lightning/uiRecordApi';

//This calls the Apex Class which is a function 
import lwcCloseCase from '@salesforce/apex/clsCloseCase.CloseCase';


export default class CloseCase extends LightningElement {
@api recordId ;

renderedCallback() {

    CloseCase({
        caseId: this.recordId  
    }) 

    .then((cases) => {
       
        const event = new ShowToastEvent({
            title: 'Success',
            message: 'Case Record has been Closed',
            variant: 'success',
        });
        this.dispatchEvent(event);

        getRecordNotifyChange([{recordId: this.recordId}]);

    })
 
    .catch((error) => {
        
        const event = new ShowToastEvent({
            title: "Error on update",
            message: error.body.message,
            variant: "error",
            mode: 'sticky',
        });
        this.dispatchEvent(event);
    });
}

}

HTML

<template>

</template>

APEX

public with sharing class clsCloseCase {
@AuraEnabled

    public static Case CloseCase(Id caseId) {
        Case soCase    = [SELECT Id, RecordTypeId, Status FROM Case WHERE Id = :caseId];
        soCase.Status = 'Close Case';
        Update soCase;
        Return soCase;
    }
}

AURA.CMP

<aura:component implements="flexipage:availableForAllPageTypes,force:lightningQuickAction" 
            access="global" >
<c:lwcCloseCase></c:lwcCloseCase>
</aura:component>
4
  • does the profile have access to the apex class? Jun 16, 2021 at 21:04
  • Doing this as System Admin
    – CodeMonger
    Jun 16, 2021 at 21:10
  • Are there any record types on case object? Remember to assign record types to the quick action.
    – user43598
    Jun 16, 2021 at 21:28
  • There are but it doesnt show on the Case Page Layout.... If there was an error that would be great.
    – CodeMonger
    Jun 16, 2021 at 21:41

1 Answer 1

6

This is a platform limitation and articulated here. Quoting from the docs below

NOTE Actions on user profiles, cases, and work orders can appear in a different way than on other records.

Actions on the user profile page come from the Quick Actions in the Salesforce Classic Publisher section of the global publisher layout. Only standard Chatter actions appear on the user profile page, regardless of which actions are assigned to the User Page Layout or the global publisher layout.

When feed tracking is enabled for cases or work orders, the page-level action menu on those records contains only custom buttons and supported standard buttons. Quick actions appear on the Chatter tab.

So how to solve this,

  • Use dynamic actions documented here

OR

  • If you do not need chatter feed, disable feed tracking for case object.
1
  • Any ideas when it doesn't even show up in chatter tab? Got a custom action calling a LWC action, and it's showing up nowhere on the case.
    – Schnaps
    Aug 18, 2022 at 9:18

You must log in to answer this question.

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