For those that have gone through migration from Classic to Lightning, you may find that you took for granted a few features we assumed would always be standard functionality. While the migration to Lightning is a powerful and necessary update, missing basics like the Close Case button can prevent some companies or subsets of users from making the migration. The value of this specific feature is well documented on this IdeaExchange post from 3 years ago that now has over 20k points, 2k votes and at least one other merged idea.
While Salesforce has yet to address this in Lightning, they have moved the idea back to an "Open" status and will consider it in their future releases.
Without an existing solution, however, you are now tasked with creating a solution that can replicate or replace something that once seemed so simple. Thankfully, I believe Salesforce has given Admins the ability to develop such solutions in a creative and powerful tool called Flows.
With a major focus on clicks overs code, Salesforce has greatly extended the Admin capabilities within Flows and below I will outline out how to create one which can be applied to a custom Action to replicate the classic Close Case button.
Note: These are not detailed step-by-step instructions and are not meant to teach Flows. For additional training and resources on this or any Salesforce process discussed here, I always recommend utilizing Trailhead
Phase 1: Create a Screen Flow
Navigate to Setup and search for Flows. Click New Flow.
On the next screen, choose Screen Flow and click Create
Update: Choose either Freeform or Auto-Layout. For this task, it does not matter. I prefer Freeform however as it allows me to control how the layout of the flow looks
Using the toolbox, navigate to manager and create a new variable resource. This variable should be named "recordId" (case sensitive) and will allow your Flow to call the recordId of the case that your button lives on. For more information about the importance of this process, visit my notes on this post in the developer forum. Once complete click Done
Back in your Flow Builder, drag in a Get Records element for object = Case. The filter criteria will be that the Id of your Case matches your Variable Resource value {!recordId} that you just created. Review the image below and click done when complete
Drag in a new Screen Element to the Flow Builder. Here you have a little creative freedom and can chose the fields which are important to your case closing process. For this example, I'm simply dropping in the existing Case Subject as a display field and a text input field to capture Case Resolution notes. This is the screen that your end users will see when they click the Close Case button.
Note: I typically hide my header and hide the Back/Pause buttons for minor flow elements such as this. You will also need to ensure to provide an API name for every element you create and may get errors when trying to Save if you have not done this
Finally, drag in an Update Records element to the Flow Builder. Here you will simply be updating your existing Case with the fields from your Screen Element. For my example we're applying the Case Resolution notes to the Comments section of the Case and changing the status to "Closed" - Click Done on your element when complete
To wrap up this Flow build, connect your screen elements as shown below and then in the top RH corner, click Save. You will be required to give your Flow a name (ex: Close Case). Once you have Saved, ensure you click Activate in the top RH corner so that your flow can be used!
Phase 2: Create a Custom Close Case Action for Cases
Navigate to Setup and then to the Object Manager. Search for and select Cases and then navigate to the Buttons, Links, and Actions option in the menu on the left
Select New Action and choose Flow as your Action Type. This should open a new picklist with all of your available Flows. If you do not see the Flow you created, go back and make sure it has been saved and activated in your Flow Builder.
After you have saved your action successfully, navigate to the Page Layout of your Case and drag the newly created action to the Salesforce Mobile and Lightning Experience Actions section of your page. Save the layout and get ready to use your button!
Phase 3: Interact With Your Flow
If everything went right, you should now see your button on the Case record. When you click the button, a dialog box should pop up with your data points from the Flow's Screen Element
Note: If you are sure everything has been setup correctly and you are still not seeing the button on your case, ensure that your user (and any user who will need to use this button) has the "Flow User" permission enabled on their user record.
Using my example as a baseline, if you place comments in the Case Resolution box and click Next, the comments should be placed in the Case Comments related list and the case should be moved to "Closed"
My name is Matt Dalpini and I am a Solutions Architect at Vantage Point Consulting. If you have questions, concerns or suggestions on how to improve this process, feel free to connect with me on LinkedIn or leave a comment below and I will do my best to help. If your company is in need of Salesforce consultation, please consider Vantage Point as an option and let me know how we can be of assistance.
Disclaimer: This solution was built for a specific environment and may not be functional for your environment nor available based on your licensing
Thanks for sharing! How do we get this to work in community site?
Smart move, Matt. Great job.
Keep the tips coming!
Have you ever used it for program registration that also needs to track payments online?