The AI page builder

The AI page builder

The builder includes an optional AI Studio that creates whole pages and edits existing pages from a plain language prompt. It knows the 3B Portals platform: merge tags, conditional display, the standard components and their configuration, the design system and your org schema. It is enabled only when an AI API key is configured.

Enabling it

Set these fields on the Portal custom setting (Setup, Custom Settings, Portal):

Field Value
AI_Provider__c openai or claude
AI_Model__c The model id, for example gpt-5.5 or claude-sonnet-5
AI_API_Key__c Your OpenAI or Anthropic API key
AI_Endpoint__c The 3B AI service endpoint, default https://ai.3bapi.com/ai

All AI calls go through the 3B AI service, the same managed service used by 3B Forms Documents AI. The service calls your selected provider with your key and streams the answer back. Restrict builder access to admins, because the builder works with your key.

The call is made from the browser, so the endpoint host must be a Trusted URL (CSP). The package ships one for https://ai.3bapi.com. If you point AI_Endpoint__c at another host, add a Trusted URL for it (Setup, Trusted URLs, with Connect-src enabled).

The studio uses the configured model for your chosen provider.

If no key is present the studio does not initialise.

Working in the studio

Open the studio from the launcher in the builder side panel. The left side is a conversation, the right side is a preview of the page.

  1. Describe what you want: a whole page on an empty canvas, or a change to the current page. Select an element on the canvas first to target it precisely.
  2. Watch the stages complete: reading your org schema, planning the change, building each section, and a review pass. Each stage can be expanded to see its output.
  3. The preview shows the page as it will look with the proposed changes. Standard components appear as labelled placeholders (they need the portal session to load data); {{contactUser.*}} tags show sample values. Switch between desktop and mobile widths.
  4. Refine in the same conversation ("make the header shorter", "use a kanban instead of the table"). Every refinement returns the complete updated result.
  5. Click Apply to page. The studio writes the sections and their component configurations to the canvas and closes. Save the page as usual: the template and component_config.json are saved together.

Nothing changes on the canvas until you apply. Discard clears the pending result. When a request would replace the whole page (for example "build a client dashboard" on a page that already has content), the result is flagged before you apply it.

How a request is executed

The studio works on the page's top level sections. It does not write code against the builder.

Stage What you see
Schema The studio reads the Salesforce objects your request needs, plus the Contact and the page's context object.
Plan It decides which sections to replace, insert or remove.
Build It writes each affected section, with the configuration of every standard component in it. A replaced section keeps everything your request does not mention.
Review It checks the result against your intent and the platform rules, and corrects sections that need it. Skipped for a single small edit.
Apply When you click Apply to page, the sections and component configurations are written to the canvas. Brand colours are added to the page CSS.

Every stage uses the same knowledge: the platform rules, your brand settings, the standard component configuration, your org's custom blocks and the described schema.

What the AI knows about the platform

Brand settings

The brand panel holds the palette, fonts, rounding, vibe, tone, design and style notes, a creativity dial and the context object of the page. Settings persist in the browser and can be exported and imported as JSON. Brand colours are emitted as design system token overrides, so the preview, the canvas and the live portal render identically.

Set the context object when the page is opened with a recordId for a specific object (for example a Job Order page). The AI then uses {{record.Field}} tags and record scoped component filters for that object. Leave it empty for pages about the logged in contact.

Tips for good results

Troubleshooting

Symptom Cause and fix
"Unsupported value: 'temperature'" from OpenAI Fixed in version 11: reasoning models no longer receive a temperature. Update the builder static resource.
Studio missing from the builder No AI_API_Key__c on the Portal setting for the current user or profile.
Components show as placeholders in the preview Expected. Data loads once the page is applied and viewed in the canvas or the portal.
The plan targets the wrong section Select the element you mean before prompting, or name the section heading in the request.
A request fails immediately with a 4xx error Check the model id and the key; the message is shown in the conversation.
"Invalid x-api-key header" (401) The service could not use the key. Re-enter AI_API_Key__c and reload the builder.
Network error in the browser console, nothing in the thread The AI endpoint host is missing from Trusted URLs, so the browser blocked the request.