Skip to main content

Creating Diagrams with the AI Assistant (Mermaid)

Ask the AI Assistant to diagram your Salesforce configuration, a process, or a solution design — it returns Mermaid code you can render in Lucidchart, mermaid.live, and more.

Written by Engineering Swantide

Swantide's AI Assistant can turn your Salesforce configuration — or any process or solution design you're working through — into a visual diagram. It writes Mermaid code (a simple text-based diagramming format), which you paste into a free editor to render, edit, and export the picture. Because Swantide reads your org's actual metadata, the diagram reflects your real configuration — not a generic example.

When to use this

  • Map how a Flow, automation, or object is structured before you make changes.

  • Sketch a solution design and share it with stakeholders.

  • Document a business process as a flowchart for a technical design document or presentation.

  • Visualize how objects relate to each other (an entity-relationship diagram).

  • Onboard a new team member and explain complex logic quickly.

How it works

  1. Ask the Assistant for a Mermaid diagram. Describe what you want to visualize — something in your org, a process, or part of a solution design — and name the specific components (a Flow, an object, the fields involved) for the most accurate result.

  2. The Assistant returns the Mermaid code as a code block in its response (you'll see something like graph TD or flowchart at the top), often with a short summary of the components it included.

  3. Render it in a Mermaid editor (next sections) to turn the code into a picture.

Sample AI Assistant prompts

"Generate a Mermaid diagram for the flow Lead_Assignment_and_Routing. Include all decision elements, record lookups, assignments, and subflows. Use clear labels for each node."

"Create a Mermaid flowchart of our Lead-to-Opportunity conversion process, including the key automations that fire at each step."

"Generate a Mermaid entity-relationship diagram showing how the Opportunity object relates to Account, Contact, and our custom objects."

"I'm designing a new approval process for high-value deals. Draw a Mermaid flowchart of the approval steps and decision points so I can review it with my team."

"Generate two Mermaid diagrams for the flow Case_Escalation_Process: a high-level version for stakeholders and a detailed version for developers."

Using the output

Swantide returns the Mermaid code as a copyable code block — use the copy button on the block to grab the whole definition. The Assistant returns the code, not a rendered picture, which is what the editor in the next step is for. The syntax looks like this:

graph TD
A[Record Created] --> B{Is Lead Source Web?}
B -->|Yes| C[Assign to Web Queue]
B -->|No| D{Is Lead Source Partner?}
D -->|Yes| E[Assign to Partner Queue]
D -->|No| F[Assign to General Queue]

Importing into Lucidchart

  1. Copy the Mermaid code from Swantide's response.

  2. In Lucidchart, go to File → Import Data → Mermaid.

  3. Paste the code and click Import.

  4. Adjust layout and styling as needed.

Other Mermaid viewers

  • Mermaid Live Editormermaid.live/edit — paste the code on the left and the rendered diagram appears instantly on the right; export as PNG or SVG.

  • VS Code — install the Mermaid Preview extension.

  • Confluence — use the Mermaid Diagrams macro.

  • Miro — use the Mermaid integration to paste directly onto a board.

Tips

  • Be specific about the components. Naming the exact Flow, object, or fields you want in the diagram produces a more accurate result than a broad "diagram my whole org" request.

  • Iterate in the same chat. If the first diagram isn't quite right, ask a follow-up — "add the validation rules," "simplify to just the happy path," "group the steps by team" — and the Assistant will revise the code.

  • Ask for different levels of detail — a high-level diagram for stakeholders and a detailed one for developers.

  • Expect a short wait per prompt. Swantide reads the relevant metadata in depth before drafting the diagram.

  • Start a new thread for each new diagram to avoid context carrying over from a previous one.

A note on completeness

A diagram is a strong starting point for understanding and communication. When you need an exhaustive, guaranteed-complete inventory of a component's references, the Data Dictionary remains the source of truth — use it alongside the diagram when completeness matters.

Did this answer your question?