The independent daily for Salesforce admins, developers and architects

Curated by Abhinav (opens in a new tab)

Recommended

Exposing HXL widgets to Slackbot through a custom MCP server (opens in a new tab)

You will learn what a custom MCP server needs before Slackbot can render HXL widgets, how to connect Slack through the Salesforce Org Connection, and how to set tool permissions and descriptions so the right tool is chosen.

Why read this

You will also see how to troubleshoot a missing card.

  1. Check the MCP server definition
  2. Map users by Federation ID
  3. Request and approve the org connection
  4. Add the MCP server in Slack admin
  5. Turn on the server and set tool permissions
Steps to make an HXL widget appear in Slackbot, in the order the article gives them

The article explains how to make an existing HXL widget appear in Slackbot. If a widget already renders in Claude or ChatGPT, it can render in Slackbot without changes to the widget, the Apex action or the Custom Lightning Types. The remaining work is configuration: deciding how Slack connects to the Salesforce MCP server, who can use it, and which tools Slackbot may run. The author uses the Pronto sample app to show a storefront card and a follow-up menu card.

Before connecting, the server must be active, every resource needs a description, each tool’s uiResource must match a resourceName, and each tool’s readOnly and destructive flags must be set. Slackbot treats unclassified tools as write tools, which adds confirmation prompts. The connection itself is made through the Salesforce Org Connection: users are mapped by Federation ID, the org is requested and approved from Slack and Setup, and the MCP server is added in Slack admin and confirmed by a Date added value.

Each user then turns on the server in Slackbot and approves tools, choosing Allow once, Always allow or Deny per tool. Two limits apply: up to five active servers per user, and a 60-second timeout per call, with stateless calls that rerun the Apex action, so calls should stay small. Overlapping tools on other servers or Slackbot’s own Salesforce search can cause a plain table instead of the card, so descriptions should be specific.

The troubleshooting section maps common symptoms, such as plain text, missing tools, or blank values, to causes and fixes. Testing with a debugging tool like MCP Inspector helps separate server definition problems from Slack problems.

Read the original at Salesforce Developers Blog (opens in a new tab)

Also told by InfallibleTechie (opens in a new tab)

Worth reading?

Must-read

How HXL widgets reach the screen in Agentforce and MCP clients (opens in a new tab)

You will learn the two routes a Headless Experience Layer widget takes from a user's question to a card on screen, one through Agentforce and one through MCP clients, and where each route fails.

Why read this

You will also see how to troubleshoot a missing card in each.

Route 1: Agentforce

  • LLM calls show_tool_results
  • LLM sees result plus ID only
  • Agentforce Client draws with Lightning Web Components

Route 2: MCP clients

  • Host shows any tool with a renderer
  • LLM sees data, never the widget
  • Renderer draws in a sandboxed iframe
The two routes differ in who decides to show the card and who draws it

The Headless Experience Layer beta lets a developer define a widget once and show it as an interactive card in Agentforce, Slackbot, Claude and ChatGPT. How the widget appears depends on the client the user is chatting in, and the article splits this into two runtime routes. The example throughout is a customerReviews widget from the Pronto sample app, which an agent produces by calling the getCustomerReviews Apex action.

In Route 1, inside Agentforce, the runtime stores the action’s output under a short ID and marks it as displayable when the surface supports widgets and the action is flagged is_displayable. The LLM then calls the built-in show_tool_results action with that ID, which carries only a caption and the ID. The runtime resolves the result and its Custom Lightning Type, and the Agentforce Conversation Client hydrates the widget in the browser from JSON. Rendering depends on the model choosing to make that call, so the article suggests asking for the card in the agent’s instructions.

In Route 2, an MCP server advertises a renderer address for each tool. The client loads the HXL renderer in a sandboxed iframe and calls the tool, and the server returns text for the model, the raw structured output, and a hydrated widget in metadata. The host pushes the widget into the iframe, while the LLM reads only the data and writes the answer.

The article closes with a comparison of the two routes on who decides to show the card, what the LLM sees, where data meets the widget and who draws it. It also gives a troubleshooting checklist for each route, including checking for the is_displayable flag, the show_tool_results call, the resource URI in tools/list, and whether the tool call returned an error.

Read the original at Salesforce Developers Blog (opens in a new tab)

Worth reading?

Pronto sample App shows how to build Headless Agentforce experiences (opens in a new tab)

You will see how one sample app wires Agentforce agents, custom MCP servers and HXL widgets together, and which tool types and latency trade-offs to weigh when exposing Salesforce logic to external clients.

  1. Agentforce agents and actions in the org
  2. Hosted MCP Servers expose the tools
  3. External Client App connects the client
  4. Third-party agent renders HXL widgets
How the Pronto employee assistant reaches users across surfaces

The Pronto sample app is an open-source example built on the Headless Toolkit, set around a fictional food delivery platform. It ships two Agentforce agents: an employee assistant and a customer service assistant. Both are orchestrator agents that share a storefront explorer assistant as a connected subagent, which shows how multi-agent orchestration can transfer conversations and reuse subagents without losing context.

The app also demonstrates exposing business logic through Salesforce Hosted MCP Servers. Its employee MCP server offers several tool types: Apex tools built from invocable actions, an Apex REST tool for storefront search registered through the API Catalog, and an Agentforce agent exposed as a custom MCP tool. The article notes that the agent-as-tool adds latency, because Agentforce makes further LLM calls after the first call to the MCP server.

Pronto is delivered to several surfaces from one codebase: an LWR Experience Cloud customer site, and external clients such as Claude, Slack and ChatGPT. Through the Headless Experience Layer Beta, the employee server can return rich HXL widgets, such as an order status card, which render the same way on each surface. Readers can create an External Client App, connect the server to a third-party agent, and deploy the source from GitHub to try it.

Read the original at Salesforce Developers Blog (opens in a new tab)

Worth reading?

Must-read

Moving display logic from Apex into HXL widget formulas (opens in a new tab)

You will learn how to express conditional display, badge coloring, arithmetic and blank checks as formulas inside HXL widget JSON, what the formula functions can and cannot do, and why deployed widget schemas can only grow.

Before: Apex

  • Precomputes ratingVariant
  • Computes winRate in Apex
  • Sends hasPhone and hasOpenPipeline

After: widget formulas

  • CASE() picks the badge variant
  • IF() guards the win rate division
  • NOT(ISBLANK()) checks the phone
Display logic moves from the Apex DTO into the widget itself

HXL widgets are declarative JSON components, currently in beta, that can be embedded in Claude, ChatGPT and Agentforce. Their {!…} expressions can use math, comparison and logic operators and functions such as IF, CASE, AND and LEN, so display logic can sit beside the display rather than in Apex. The author shows an account card whose display fields were first precomputed in an Apex DTO and then replaced with formulas for visibility, badge variant, win rate and phone presence.

The author notes limits. There are no formatting functions for dates or currency, so those values still need formatting in Apex, and there is no aggregate such as SUM or AVERAGE across a list. Moving an existing widget also has a catch: a deployed schema.json can only grow, so removing old properties requires deploying a new widget bundle and repointing the Custom Lightning Type renderer.

The post also points to the Headless Experience Layer Playground for testing formulas live and to a formula reference in the Salesforce platform-widget-generate skill for coding agents.

Read the original at Salesforce Developers Blog (opens in a new tab)

Worth reading?

Must-read

Building interactive UI with the Headless Experience Layer for Agentforce and MCP clients (opens in a new tab)

You will learn how to structure declarative JSON widgets, bind them to Apex data using Custom Lightning Types, and configure Agentforce to render interactive cards instead of plain text.

  1. Write an Apex invocable method to return data
  2. Package the layout into a UiWidgetBundle
  3. Link output shape to widget via renderer config
  4. Update Agent Script to mark data displayable
  5. Test layouts in HXL Playground before deploy
Workflow for building and testing interactive widgets with HXL

The post introduces the Headless Experience Layer (HXL), part of Salesforce’s Headless Toolkit, which lets developers define an interactive widget once in declarative JSON and have it render natively in Agentforce and in any MCP client that supports MCP Apps. Instead of an agent replying with plain text, the same action can return a branded card that looks and behaves consistently across channels. Widgets are composed from reusable components rather than built as Lightning Web Components or React apps, and they only display what the underlying Apex action returns, so existing sharing and field-level security still apply. HXL rests on three concepts: components, which are surface-aware UI primitives; widgets, which combine components into a use case; and Custom Lightning Types (CLTs), which describe the shape of the data and whose renderer tells the platform which widget draws it and how fields map onto its attributes.

The authors illustrate the approach with a review card from Pronto, their fictional food-delivery sample app. The card is built from four pieces: a global Apex invocable action (GetCustomerReviewsAction) that returns review data; a widget whose files live in a UiWidgetBundle, namely a registration XML file, a JSON composition built from tile blocks with a forEach loop for list items, and an optional schema; a CLT that binds the action’s output to widget attributes using {!$attrs} and similar paths; and an agent output or MCP tool that marks the output as displayable. In Agentforce, the Agent Script sets is_displayable to True, and the model decides when to show the card, which in the authors’ testing usually happens on the first question of a fresh conversation. For MCP clients such as Claude and ChatGPT, two nested CLTs are needed because the tool output is wrapped in an envelope; only the outer type carries the renderer, and an MCP server entry publishes it as a UI resource that the tool references. The HXL Playground offers a browser-based way to preview layouts with sample data, though previews may differ from the live experience.

The post closes with getting started steps: enable Headless Experience Layer (Beta) under Feature Settings in Setup, use API version 67.0 or later, clone and install the Pronto app, and optionally use the open-source Salesforce Skills library to generate widgets, CLTs and MCP types with an AI agent. It also points to a hands-on workshop, and it presents HXL as a way to deliver consistent interactive UI across agent surfaces with less integration code.

Read the original at Salesforce Developers Blog (opens in a new tab)

Worth reading?

Use Headless Experience Layer to build agentic user interfaces across multiple platforms (opens in a new tab)

You will learn how to implement the Headless Experience Layer to design interactive AI workflows that render consistently across external agentic surfaces.

Why read this

The session also covers practical guidance from Salesforce experts through a live question-and-answer format.

The presentation introduces the Headless Experience Layer as a tool for developing interactive artificial intelligence workflows. By leveraging this layer, developers can create a single workflow definition and deploy it across various agentic environments without rebuilding the interface for each target.

The approach emphasizes delivering consistent and rich user experiences natively on third-party platforms such as Slackbot, ChatGPT, and Claude. This allows teams to maintain a unified design language while extending their Salesforce AI capabilities beyond the standard interface.

The video concludes with a live expert session where attendees can submit technical questions about implementation patterns, configuration requirements, and best practices for scaling these agentic interfaces.

Watch the video at Salesforce Developers on YouTube (opens in a new tab)

Worth reading?