Portal Community

Invoking the AI Form Generator

The Atlas Form AI generator accepts your SQL CREATE TABLE statement and produces a complete form definition. Three ways to invoke it:

1. AtlasForms Studio (Visual)

In the AtlasForms Studio: New Form → Generate with AI → From SQL Table. Paste the CREATE TABLE script. The AI generates and previews the form in the designer immediately.

2. API Call

POST /api/forms/generate
{
  "generationType": "SqlSchema",
  "tenantId": 42,
  "sqlSchema": "-- Paste full CREATE TABLE statement here",
  "formOptions": {
    "excludeColumns": [
      "TenantId", "CreatedAt", "UpdatedAt", "CreatedBy",
      "IsDeleted", "DeletedAt", "EmbeddingRef", "AiProcessedAt",
      "AiModelVersion", "SummaryText", "ClassificationLabel", "SentimentScore"
    ],
    "primaryKeyColumn": "LeadId",
    "formTitle": "New Lead",
    "datasourceId": "sales-data-db",
    "generateSqlCommands": true,
    "generateSections": true
  }
}

3. Octopus AI Chat

In an Octopus chat session, describe your table to the AI: "Generate an AtlasForms form for my Lead table with these columns..." The AI generates the form JSON and the CRUD SQL commands in the conversation.

What Gets Generated for the Lead Table

For the Lead table from the previous page, the AI generates:

Form Sections and Fields

SectionFieldsControls
Contact InformationFullName, Email, PhoneText, Email, Phone inputs — FullName and Email required
Company DetailsCompanyName, Source, EstimatedValueText, Dropdown (lead sources), Currency input
AssignmentAssignedToUserId, Status, FollowUpDateUser picker, Status dropdown, Date picker
NotesNotesMulti-line text area

Generated Validation Rules

{
  "validationRules": [
    { "field": "FullName",  "rules": [{ "type": "required" }, { "type": "maxLength", "value": 300 }] },
    { "field": "Email",     "rules": [{ "type": "required" }, { "type": "email" }, { "type": "maxLength", "value": 300 }] },
    { "field": "Phone",     "rules": [{ "type": "phone" }, { "type": "maxLength", "value": 50 }] },
    { "field": "Source",    "rules": [{ "type": "required" }] },
    { "field": "Status",    "rules": [{ "type": "required" }] },
    { "field": "EstimatedValue", "rules": [{ "type": "minValue", "value": 0 }] }
  ]
}

Generated SQL Commands

-- CREATE command (form submit action: Create)
INSERT INTO Lead
    (LeadId, TenantId, FullName, CompanyName, Email, Phone,
     Source, Status, AssignedToUserId, EstimatedValue, Notes,
     FollowUpDate, CreatedBy, CreatedAt, UpdatedAt)
VALUES
    (NEWID(), @tenantId, @fullName, @companyName, @email, @phone,
     @source, @status, @assignedToUserId, @estimatedValue, @notes,
     @followUpDate, @createdBy, GETUTCDATE(), GETUTCDATE())

-- UPDATE command (form submit action: Update)
UPDATE Lead SET
    FullName = @fullName,
    CompanyName = @companyName,
    Email = @email,
    Phone = @phone,
    Source = @source,
    Status = @status,
    AssignedToUserId = @assignedToUserId,
    EstimatedValue = @estimatedValue,
    Notes = @notes,
    FollowUpDate = @followUpDate,
    UpdatedAt = GETUTCDATE()
WHERE TenantId = @tenantId
  AND LeadId = @leadId
  AND IsDeleted = 0

Customizing the Generated Form

After import, typical customizations in the AtlasForms designer:

Replace Free-Text with Dropdowns

The AI generates text inputs for Source and Status by default. In the designer, change these to Dropdown controls and bind them to the LeadStatus and LeadSource reference data tables using a SQL data source query.

User Picker for AssignedToUserId

Change the text input for AssignedToUserId to a User Picker control that queries the BizFirstGO user directory. The picker returns a userId string that is stored in the column.

Conditional Field Visibility

// Show FollowUpDate only when Status is 'Contacted' or 'Qualified'
{
  "field": "FollowUpDate",
  "visibilityRule": {
    "condition": "OR",
    "rules": [
      { "field": "Status", "operator": "equals", "value": "Contacted" },
      { "field": "Status", "operator": "equals", "value": "Qualified" }
    ]
  }
}
Form Versioning

AtlasForms maintains version history for every form. When you update the SQL schema (e.g., add a new column), re-run the AI generator to produce an updated form definition, then import it as a new version. Existing form submissions reference the version they were created with, preserving historical data integrity.

Wiring the Form to CRUD Workflows

After finalizing the form design, configure the form's submit action to trigger the appropriate Flow Studio workflow: