Transform Unstructured Text with an AI-Powered Flow — How I Solved It (Guide for Admins)

A practical walkthrough showing how to use Agentforce AI agents in Salesforce Flow to convert messy customer messages into structured orders — no code required.

Overview

This guide explains how to build an AI-powered screen flow that reads unstructured text (emails, chats, or messages), parses order details using an AI agent, and creates related records in Salesforce automatically. The pattern uses two AI agent actions: one to extract structured data and another to create records (with autolaunched flow actions for record lookup and creation).

Why this matters

Unstructured customer messages are common and costly when handled manually. By embedding AI agent actions in Flow, admins can reduce manual data entry, lower error rates, and accelerate processing — all without writing Apex code.

Key components

  • AI Agent (Agentforce) — Define topics and instructions (e.g., “Parse Order Information” and “Place a Cupcake Order”) with clear structured output definitions.
  • Screen Flow — Collect the unstructured message and show human-in-the-loop review screens.
  • Autolaunched Flows / Flow Actions — Lookup Contact ID, create Order record, and create Order Item records. These are invoked by the agent.
  • Structured Output — Specify exact field names, data types, and descriptions so the LLM can populate outputs Flow can use.

Step-by-step implementation

  • 1. Build and activate your agent

    Create an agent (example: “Order Transposer Agent”) and add topics such as Parse Order Information and Place a Cupcake Order. Provide detailed, prescriptive instructions for each topic so the model knows how to extract values, translate ambiguous dates, assign priority, and format outputs.

  • 2. Define structured outputs

    For parsing, include outputs like customerName (string), orderDate (datetime string), totalQuantity (number), orderDetails (string list or formatted text), specialInstructions (string), and priority (string). Clear descriptions and matching Flow data types are crucial.

  • 3. Create autolaunched flows used as agent actions

    Build small autolaunched flows that perform single responsibilities: one to get Contact ID by name, one to create the Order record and return its ID/number, and one to create individual Order Item records. The agent can call these actions as needed.

  • 4. Build the screen flow

    Design a simple screen flow that: collects the unstructured message, invokes the agent to parse structured data, displays parsed results for review, then—on confirmation—invokes the agent to place the order (passing session ID to preserve context).

  • 5. Map structured outputs into Flow

    Use the AI agent action outputs as Flow resources. Populate screen fields from the structured outputs for human review. When calling the place-order topic, pass the agentResponse and sessionId from the first action so the agent can create records using the same context.

  • 6. Test and iterate

    Test with real-world messages, edge cases (missing date, ambiguous quantities), and ensure the agent asks clarifying questions when data is incomplete. Tune instructions and output descriptions for accuracy.

Best practices

  • Write explicit, deterministic instructions for the agent (examples: date format mm/dd/yyyy, use noon as default time).
  • Keep autolaunched flows small and single-purpose so they’re easy to reuse and maintain.
  • Use the human-in-the-loop pattern: always show parsed outputs for review before creating records in production orgs.
  • Preserve session context (sessionId) across agent actions to maintain conversation continuity.
  • Log agent responses and record actions for audit and troubleshooting.

Use cases

This pattern applies beyond orders: case triage (escalate angry customers to urgent cases), lead qualification (extract product interest and score leads), service routing, and document ingestion where unstructured text needs to become structured records.

Quick troubleshooting

  • If the agent returns unexpected formats, improve the structured output descriptions and add example inputs/outputs.
  • If the agent misses contact lookup, ensure your autolaunched flow handles fuzzy name matching and returns helpful error messages so the agent can prompt for clarification.

Conclusion — Why this matters for admins, developers, and business users

Embedding AI agents in Flow moves powerful language understanding into the admin toolbox. Admins can automate previously manual processes, developers can focus on complex integrations rather than parsing logic, and business users get faster, more accurate processing of customer conversations. This reduces swivel-chair work, lowers error rates, and enables faster response times — delivering real ROI and improved user experience.