Skip to main content

displayRecord

This function populates the form controls with data from a record object. It is typically used after retrieving a record with functions like loadRecord(), loadRecordById() or loadConfigRecordById().

Syntax

app.displayRecord(record, originField, noModifiedCheck, preventLoadedEvent)

Parameters

ParameterTypeDescription
recordObjectThe record object to display in the form
originFieldString(Optional) The control ID that triggered this operation. This control will be excluded from the unsaved changes check
noModifiedCheckBoolean(Optional) If true, skips the check for unsaved changes. Default is false
preventLoadedEventBoolean(Optional) If true, does not trigger the "RecordLoaded" event. Default is false

Return Value

This function doesn't return a value. It populates the form with data from the provided record object.

Examples

Example 1: Basic display of a record:

// Load and display a record
const myRecord = await app.loadRecordById(123);
await app.displayRecord(myRecord);

Example 2: Display a record and specify the origin field (to exclude from the modified check):

// Display a record and specify that "customerIdField" triggered this action
await app.displayRecord(customerRecord, "customerIdField");

Example 3: Display a record without checking for unsaved changes:

// Force display a record without checking for unsaved changes
await app.displayRecord(myRecord, null, true);

Events

EventTimingPurpose
RecordLoadedAfter displaying the recordNotifies that a record has been loaded and displayed

Notes

  • If there are unsaved changes in the form and noModifiedCheck is false, the function will show a confirmation dialog.
  • When displaying a record with returnEventType === "returnDispatch", the function will execute special processing.
  • The function calls reInitValidation() to reinitialize form validation after displaying the record.