Dynamic form, record detail and record create

Dynamic form, record detail and record create

The Dynamic Form component brings a form designer into the page builder. You pick a context object, design the form and decide whether it is an input form (edit or create the record) or output only (a read only record detail). No submission records are created: answers are written straight to the record.

Designing a form

Dropping the block opens the form designer, a full screen modal with two panes:

The question name is the field API name. That binding is how answers reach the record, so do not rename questions bound to fields. Questions whose names are not fields of the object (an HTML block, a file upload, a free question) are simply not written.

Click Apply, then save the page. The field design, submit button label, success message and other record settings are stored with the page and are restored when you reopen the builder.

Which record

Record source Behaviour
The logged in contact (default) The object must be Contact. The form loads and saves the session contact.
The context record (URL recordId) The record type must match the object. A scope filter such as Contact__c = :contactUser.Id is required so a visitor cannot point the form at somebody else's record. Tick Allow any record id only for deliberately open data.
Always create a new record Every submission inserts a record. Use the Contact link field (for example Contact__c or ContactId) to link it to the logged in contact automatically, and Default values for hidden fields such as Origin = Web.

Require login is on by default. Turn it off for public forms that create records.

Files

Add a File upload question from the palette. Files are uploaded as soon as the user picks them, are linked to the record when it already exists, and are linked to the record created on submit otherwise. The maximum size is 6 MB per file.

Output only mode

Choose Output only - record detail to render the same design read only. This is the quickest way to build a record detail page: pick the fields from the palette, arrange them in panels and switch the mode.

After submit

The success message replaces the form. Optionally set an After submit action to navigate to a page or URL (the new record id is available as [[Id]]). The component fires portalformsaved with the record id and the values.

Example configuration

{
    "type": "dynamic-form",
    "objectName": "Case",
    "mode": "input",
    "recordSource": "new",
    "contactLinkField": "ContactId",
    "defaultValues": [{ "field": "Origin", "value": "Web" }],
    "requireLogin": true,
    "submitLabel": "Send request",
    "successMessage": "Thanks, we will be in touch.",
    "redirect": { "type": "page", "page": "My Cases" },
    "surveyJson": { "pages": [{ "name": "page1", "elements": [{ "type": "text", "name": "Subject", "title": "Subject", "isRequired": true }, { "type": "comment", "name": "Description", "title": "Description" }, { "type": "file", "name": "file_1", "title": "Attachments", "allowMultiple": true, "storeDataAsText": false }] }] }
}

Field type handling

Salesforce type Question Notes
Text, email, phone, URL Single line input with matching input type
Long text, rich text Long text Rich text is saved as entered
Number, currency, percent Number input
Date, date time, time Date, date time or time input Date times are converted to the user's local time zone
Checkbox Yes / no
Picklist Dropdown with the picklist values Dependent picklists are not filtered
Multi select picklist Tag box Stored as a;b
Lookup Text (record id) Dynamic lookups are not provided in this version

Deployment note

The designer and the runtime rely on two static resources shipped with the package, listed in Setup as SurveyJS and SurveyCreator after the form library they carry. Nothing needs to be configured, but both must be deployed with the rest of the package. The stylesheet is the library's fontless build, so a form inherits the portal's own typography rather than pulling web fonts of its own, and the library's English wording is relabelled at load time so the form never calls itself a survey.