Skip to content

Build a supplier support chat workflow

Build a chat workflow that looks up a supplier’s current status and summarizes a CSV uploaded to the conversation. A follow-up can refer to the same supplier or file. When the user switches tasks, the workflow clears the previous selection and offers suggestions for the new task.

Before you begin

Set up the read-only supplier status Business Object function. It accepts an internal supplier record key. Choose a supplier record the chat user is authorized to read, and note its key for the walkthrough.

Workflow flow

flowchart TD
    Start([Chat message]) --> Classify["LLM · Classify the request"]
    Classify -->|Unknown intent| Clarify([Ask for clarification])
    Classify -->|Supported intent| Indicator["Tool · Intent Change Indicator"]
    Indicator --> Changed{"If Condition · Did the intent change?"}
    Changed -->|Yes| Reset["Set Variables · Clear the saved supplier and file"]
    Reset --> SaveIntent["Set Variables · Save the intent for this turn and the conversation"]
    Changed -->|No| SaveIntent
    SaveIntent --> Route{"Switch · Current intent"}
    Route -->|Supplier status| Supplier{"Supplier key available?"}
    Supplier -->|No| AskKey([Ask for the supplier key])
    Supplier -->|Yes| Lookup["Business Object Function · Look up supplier status"]
    Lookup --> SaveKey["Set Variables · Save the supplier key"]
    Route -->|File review| FileAction{"Which file action?"}
    FileAction -->|Upload help| Help([Explain how to upload the CSV])
    FileAction -->|Summarize| Read["Tool · Chat Attachments Reader"]
    Read --> SelectFile{"Eligible CSV identified?"}
    SelectFile -->|No| AskFile([Ask the user to choose or upload a CSV])
    SelectFile -->|Yes| Count["Code · Validate and summarize the CSV"]
    Count --> ValidCSV{"CSV is valid?"}
    ValidCSV -->|No| FileError([Explain the CSV format])
    ValidCSV -->|Yes| SaveFile["Set Variables · Save the filename and current summary"]
    SaveKey --> SupplierAnswer["LLM · Answer using the lookup and chat history"]
    SaveFile --> FileAnswer["LLM · Answer using the summary and chat history"]
    SupplierAnswer --> Result([Return the answer])
    FileAnswer --> Result

Configure the chat experience

  1. In Settings > Questions, enter these starter questions in order.
  2. Check a supplier's status.
  3. How do I upload a supplier CSV?
  4. Summarize a supplier CSV I've uploaded.
  5. Turn on Follow-up Questions and configure the suggestion prompt.
  6. In Settings > Chat Experience, turn on Enable file upload. To also accept files from cloud storage, configure a provider in Credentials > Chat Experience. Then turn on Enable third party file upload for the workflow and select at least one provider.

Configure the workflow

Define workflow variables

Variable Type Scope Purpose
lastIntent String Conversation Last supported task, used to interpret related turns and detect task changes.
activeSupplierId String Conversation Record key from the last successful supplier lookup.
activeFilename String Conversation Full filename from the last successful CSV review.
turnIntent String User Question Task that routes the current turn.
fileSummary Object User Question Counts calculated for the current turn. Recompute them when the user asks about an earlier file.

Define the fileSummary Type Specification with the String field filename and Integer fields totalSuppliers, activeSuppliers, and inactiveSuppliers.

Classify and route each turn

  1. Add an LLM node named CLASSIFY_REQUEST. Pass {{$context.$system.$inputMessage}} and {{$context.$variables.lastIntent}}. In its JSON output specification, declare the String fields intent, fileAction, supplierId, and filename.
  2. Classify each request as SUPPLIER_STATUS, FILE_REVIEW, or UNKNOWN. Use the previous intent only for a clearly related follow-up. For FILE_REVIEW, use UPLOAD_HELP or SUMMARIZE as the file action. Extract a supplier key or filename when the user provides one, and use an empty string for fields that are absent or do not apply.
  3. Ask for clarification on the UNKNOWN path and preserve the saved intent and selections. For supported intents, add a Tool node of type Intent Change Indicator and set Intent to {{$context.$nodes.CLASSIFY_REQUEST.$output.intent}} so the tool can segment chat history when the task changes.
  4. Compare the classified intent with lastIntent. If it changed, use Set Variables to clear activeSupplierId and activeFilename. Then save the classified intent to lastIntent and turnIntent.
  5. Set the Switch case expression to {{$context.$variables.turnIntent}}. Route SUPPLIER_STATUS to the supplier lookup and FILE_REVIEW to the file path.

Look up a supplier

  1. Use the record key from the current message if present. Otherwise, use {{$context.$variables.activeSupplierId}}. If neither has a value, ask the user for the record key.
  2. Pass the resolved key to the Business Object Function. After a successful lookup, save the key as activeSupplierId.
  3. Pass the current message and lookup result to the answer LLM. Use Return to return the answer.

Read and summarize an uploaded CSV

  1. Read {{$context.$nodes.CLASSIFY_REQUEST.$output.fileAction}}. For UPLOAD_HELP, explain how to attach a CSV, list the required columns, and tell the user to request a summary. For SUMMARIZE, continue to the attachment reader.
  2. Add a Tool node with code READ_ATTACHMENTS and type Chat Attachments Reader. Set Conversation Identifier to {{$context.$workflow.$conversationId}}, enable Parse the Files, and leave raw Base64 output off. The reader can return files from the current turn and earlier turns in the same conversation.
  3. Prefer the full filename from the current turn, then activeFilename. When neither is set, use the only eligible CSV or ask the user to choose if there are several. If the requested file is missing or there is no eligible CSV, ask the user to upload one or provide the correct filename.
  4. Pass the parsed content to a Code node. Use the resolved filename as the key into the reader output. For a file named suppliers.csv, read the content with {{$context.$nodes.READ_ATTACHMENTS.$output["suppliers.csv"]}} and the content type with {{$context.$nodes.READ_ATTACHMENTS.$output["suppliers.csv_contentType"]}}.
  5. Validate the supplierNumber,status header and count the rows by status. If the format is invalid, explain the required format. This example uses simple unquoted fields. Use a CSV-aware parser for files with quoted commas or multiline cells.
  6. After processing succeeds, save the summary in fileSummary and the filename in activeFilename. Pass the current message and {{$context.$variables.fileSummary}} to the answer LLM, then return the answer.

On both answer nodes, enable Include chat history so the LLM can resolve phrases such as “that supplier” or “that file.” Use the current lookup or CSV summary for factual claims. If you pass {{$context.$system.$chatHistory}} directly in the prompt, leave automatic history inclusion off.

For attachments stored on Fusion business records, see Validate an invoice attachment. For the original bytes of a chat upload, see the raw content mapping.

Scope the follow-up suggestions

In Settings > Questions, use the Prompt under Follow-up Questions to choose questions for the latest task. Pass {{$context.$variables.turnIntent}}, {{$context.$system.$inputMessage}}, and {{$context.$system.$chatHistory}}. Tell the model to use earlier turns only to resolve references within the current task.

Current task Suggested questions
Supplier status “Is this supplier currently active?” or “What is this supplier’s number?”
CSV review “How many suppliers are listed in the CSV?”, “How many suppliers are active?”, or “How many suppliers are inactive?”
Upload help or missing CSV “How do I upload a supplier CSV?” or “Which columns should my supplier CSV contain?”

Ask the model to choose only questions the current path can answer. Return a JSON array of objects with a question field, or an empty array when the task is unclear.

Run the example in chat

  1. Save and publish the workflow. Open a new chat and select Check a supplier's status.
  2. Use your supplier record key in the first turn below. The sample uses fictional key 1716, which maps to supplier number 8057 with status ACTIVE.
  3. Save the following sample as suppliers.csv and continue in the same chat.
supplierNumber,status
8057,ACTIVE
9102,INACTIVE
What to send Expected behavior
“Check supplier record 1716.” The chat reports that supplier 8057 is active and saves the record key.
“Is that supplier still active?” The workflow uses the saved key to look up the current status again.
Attach suppliers.csv and ask “Summarize suppliers.csv.” The workflow switches to CSV review, clears the supplier key, and reports two suppliers, one active and one inactive. The suggested questions now refer to the CSV.
Select “How many suppliers are inactive?” The workflow reads the earlier upload, calculates the count for this turn, and answers that one supplier is inactive.
“Check a supplier’s status.” The workflow switches back to supplier status and asks for a record key.

The file-processing step passes this summary to the answer node.

{
  "filename": "suppliers.csv",
  "totalSuppliers": 2,
  "activeSuppliers": 1,
  "inactiveSuppliers": 1
}

Related guides
Chat Experience · Questions · Variables · Chat Attachments Reader · Intent Change Indicator