Prefill forms blocks fields from URLs

Form component values can be pre-filled through URL parameters. Each component type has specific requirements, and the URL format must be followed carefully to avoid conflicts with modals and other system features.

Standard format

The default format is ?form=JSON, where the JSON must be URL-encoded.

# Without encoding
https://test.jestor.com.br/app/id?form={"name":"1"}

# With encoding (required)
https://test.jestor.com.br/app/id?form=%7B%22name%22%3A%221%22%7D

If the app has more than one form and each needs different pre-filled values, specify the component ID:

?form.idComponent=JSON&form.idComponent2=JSON2

Example:

https://test.jestor.com.br/app/id?form.8A6eBhYtCJYandNeXtF6t=ENCODED_JSON1&form.nNYRi8pufr1VE9cA-HTHG=ENCODED_JSON2

The component ID can currently be obtained from the component's edit URL.

JSON format

The JSON structure varies depending on the component type.

ContextFormat
Single trick button / main table in Internal forms{ "fieldId": "value" }
Form Fields / internal forms inside Internal forms{ "objectId.fieldId": "value" }

JS utility for generating form URLs

function getFormUrl(compId: string | null, values: any) {
  return `form${compId ? `.${compId}` : ''}=${encodeURIComponent(
    JSON.stringify(values),
  )}`;
}

// Examples
getFormUrl(null, { name: '1' });
getFormUrl('8A6eBhYtCJYandNeXtF6t', { name: '1' });
getFormUrl('8A6eBhYtCJYandNeXtF6t', { 'table_1.name': '1' });

// Combining multiple forms
window.location.search = [
  getFormUrl('8A6eBhYtCJYandNeXtF6t', { 'table_1.name': '1' }),
  getFormUrl('nNYRi8pufr1VE9cA', { name: '1' }),
].join('&');

Selecting a record for update via URL (Super Form)

When a Super Form block has record update enabled, you can pre-select the record to be updated through the URL.

# Select record with ID 10 in all forms
https://test.jestor.com.br/app/id?updateRecord=10

# Select record with ID 10 in a specific form
https://test.jestor.com.br/app/id?updateRecord.8A6eBhYtCJYandNeXtF6t=10
ScenarioParameter
Single form in the app?updateRecord=RECORD_ID
Multiple forms in the app?updateRecord.COMPONENT_ID=RECORD_ID