Close Case Button in Lightning Experience – Workaround
If you have Used Cases in Salesforce, I am sure you’re aware of the Closed Case layout. This is great, it lets you require the fields that must be filled out before a User can close a Case.
You might have found many workarounds for this, One of those is Creating a Quick Action.
This is good but still it doesn’t give us the exact layout and functionality which Salesforce provides for Close Case button out of the box in Classic. If you are still in search of proper solution for Close Case button which will give you exact functionality as Salesforce, You have landed on the correct place.
Let’s Jump into the Solution Directly.
I will guide step by step how you can achieve exactly the same functionality for Close Case in Lightning Experience.
- Exact same Close Case functionality as we have in Classic.
- Need to add multiple field values to close a case.
- Field may be dependent on each other
- Field validation
As you can see from the requirement, these all functionalities is hard to achieve using a Quick action.
Let’s get started with our First Step in order to build Close Case Button.
Go to Salesforce Setup => Object Manager => Case => Click on Close Case Page Layouts (In Lightning Experience, In classic Setup => Case => Close Case Page Layout). Take a note of all the fields present on the Layout and keep the layout as a reference to build your own Close Case Page.
Create One FieldSet for the above, adding all the fields from this section. Similarly, Create another FieldSet if you another section on your Close Case Layout. FieldSets will help you to manage this Close Case functionality without changing a single line of code. In future if you want to add more fields in your close case page, you will just have to add that field in the FieldSet. Till here, I assume you are ready with your FieldSets.
Create a Visualforce with Case as Standard Controller, lightningStyleSheet = true. This will make the page compatible with Lightning Experience.
Please see below the code,
Add this button to Your Case Page layout in Salesforce Mobile And Lightning Experience Action. That is it. You are ready with your fully functional Close Case Button in Lightning Experience.
I hope you will find this blog helpful. If you have any doubt or question, feel free to add in the comment and queries section.
Article Reference : Salesforce Sidekick