Skip to main content
New tool CRON Expression Builder — preview next run times before you schedule Apex. Open the builder →
Screenshot of the Salesforce utility bar showing a custom component for creating cases faster
Apex

Create Cases Faster with the Salesforce Utility Bar

Tired of agents losing notes while waiting for records to load? Here is how to build a case creation tool in the Salesforce utility bar that stays put, and why a thin Aura wrapper is still the most reliable way to hand record context to the LWC.

If you have ever worked on a high-volume Service Cloud project, you know the Salesforce utility bar is a lifesaver for multitasking agents. The scenario is always the same: a call comes in, the agent clicks the screen pop, and then they wait. And wait. While that Contact record is spinning, the customer is already talking and the agent has nowhere to put those notes. That gap is why agents end up scribbling on post-it notes or opening Notepad.

Why the Salesforce utility bar beats standard page layouts

The utility bar stays put. It doesn't care if the main workspace tab is still loading or if the agent is jumping between three different sub-tabs. Put a lightweight case creation tool at the bottom of the screen and agents get a "scratchpad" that actually saves data back to the system. What trips people up is how LWC handles context down there.

LWC is great for almost everything, but it can be flaky when you try to grab the recordId directly from the utility bar context. Sometimes it's there, sometimes it isn't. I use a thin Aura wrapper instead. It might feel like a step backward, but the Aura force:hasRecordId interface is much more reliable for this specific use case. If an agent is looking at a Contact, that ID gets passed into our component every single time.

Setting up the Aura wrapper and LWC

There are three parts: an Aura "shell," the LWC that does the actual work, and a simple Apex controller. It follows the standard LWC component communication pattern, where the parent (Aura) handles the context and the child (LWC) handles the UI. The Aura side looks like this:

<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes,lightning:utilityItem">
    <aura:attribute name="recordId" type="String" />
    <c:createCaseUtility contactId="{!v.recordId}"/>
</aura:component>

The Aura component sits there, grabs the ID of whatever record the agent is looking at, and hands it off to the LWC. That keeps your LWC "clean" so it can focus on the form logic and the save process.

The LWC logic

The LWC does the heavy lifting. You want to confirm you're actually on a Contact record before allowing a save, while still letting the agent start typing before the ID arrives. I've seen teams try to use Flow for this, but when you need specific UI behavior or complex validation, choosing code over automation is often the better move for performance.

import { LightningElement, wire, api } from 'lwc';
import createCase from '@salesforce/apex/CreateCaseController.createCase';
import { minimize, EnclosingUtilityId } from 'lightning/platformUtilityBarApi';

export default class CreateCaseUtility extends LightningElement {
    @api contactId;
    @wire(EnclosingUtilityId) utilityId;

    handleSave() {
        if (!this.contactId || !this.contactId.startsWith('003')) {
            // Show a quick error - needs to be a contact!
            return;
        }
        // Call your Apex here
    }
}

Making it useful for agents

A form on its own is just a form. A few small touches make the utility bar version worth using. I like to include a "Minimize on Save" feature: once the agent hits save and the case is created, the utility bar window tucks itself away. Small thing, but call center agents notice it, because it clears their screen for the next task.

Pro tip: Always check that the recordId starts with '003'. If an agent opens the utility bar while looking at an Account or a custom object, you don't want them accidentally linking a Case to the wrong record type.

You can also use the getRecord wire adapter to pull in the Contact's name or phone number. Showing "You are creating a case for [Contact Name]" right in the utility window tells the agent they're attaching the data to the right person.

Key takeaways

  • The Salesforce utility bar is the best place for "always-available" tools that shouldn't be tied to page loads.
  • Use an Aura wrapper to pass recordId to your LWC to avoid the common "undefined ID" bugs.
  • Always validate the record context (like checking for the '003' prefix) before allowing a save.
  • Keep the UI compact. The utility bar is a small space, so don't overcomplicate the form.
  • Automate the "minimize" action after a successful save to keep the agent's workspace clean.

Wrapping it up

Building a custom case creator for the utility bar comes down to understanding how agents work. They are in a rush, talking to a customer, with no time for slow pages. This pattern gives them somewhere fast and reliable to put the information while the rest of the console catches up.

Newsletter

One email every Tuesday

New guides, tool updates, and the release-note changes that break things.

No spam. Unsubscribe in one click.

Comments

Loading comments...

Leave a Comment