Members
-
addOnRefreshRL :function
Additional callback after refreshing record link
-
Description
Override this to perform additional actions after refreshRecordLink completes.
Examples
loader.addOnRefreshRL = () => { SETVALUE('child_count', loader.appRecords.length) } -
duplicateAlert :function
Alert function for duplicate detection
-
Description
Override this to customize the duplicate record alert message.
Examples
loader.duplicateAlert = () => { ALERT('This project is already assigned to another record.') } -
loadForm
Loads form schema
-
Description
Loads a Fulcrum form schema and passes it to the callback. Delegates to FulcrumHelpers.loadForm.
Parameters
Name Type Description formIDstring Fulcrum form ID to load
callBackfunction Function to receive the loaded form schema
Returns
-
loadRecords
Loads records with flexible parameter handling
-
Description
Wrapper for FulcrumHelpers.loadRecords with enhanced parameter handling. Supports flexible parameter formats for convenience in MLoadRecords context.
Parameters
Name Type Attributes Default Description optsObject | Array.<string> | string | null <optional> Can be: null (loads all), array of IDs, query object, or formID string
callbackfunction | null <optional> Callback function. Defaults to this.processRecords
Returns
Examples
Load by ID array
loader.loadRecords(['id1', 'id2'], myCallback)Load with query object
const opts = loader.filterTemplate('status', 'equal_to', 'active') loader.loadRecords(opts) -
getAppFvs
Loads form schema and immediately loads records
-
Description
Use in ON('load-record') event. Sets recordsOnLoad=true, then loads form schema and continues to load records. Equivalent to setting recordsOnLoad=true and calling buildAppFvDict.
Parameters
Name Type Description eventObject Fulcrum load-record event object
Returns
Examples
ON('load-record', loader.getAppFvs)Details
-
buildAppFvDict
Loads form schema only (no records)
-
Description
Use in ON('load-record') event. Loads form schema to build the form_value to data_name dictionary, but does NOT load any records. Records can be loaded later via updateLoadedRecords or loadRecords.
Parameters
Name Type Description eventObject Fulcrum load-record event object
Returns
Examples
ON('load-record', loader.buildAppFvDict) ON('change', 'species_link', loader.updateLoadedRecords) -
updateLoadedRecords
Updates loaded records from record link field
-
Description
Extracts record IDs from the configured record link field (dnRecLink) and loads those records. Clears auto fields if no IDs found.
Parameters
Name Type Description eventObject Fulcrum change event object
Returns
Examples
loader.dnRecLink = 'species_link' ON('change', 'species_link', loader.updateLoadedRecords) -
processForm
Processes loaded form schema
-
Description
Callback for loadForm. Creates the form_value to data_name dictionary (appFvs). If recordsOnLoad is true, continues to load records via refreshRecordLink or updateLoadedRecords.
Parameters
Name Type Description formObject Fulcrum form schema object
Returns
-
processRecords
Processes loaded records
-
Description
Default callback for loadRecords. Converts form_value keys to data_name keys and stores in appRecords. Calls enterLoadedData callback if recordsOnLoad is true.
Parameters
Name Type Description recordsArray.<Object> Array of raw Fulcrum record objects
Returns
-
selfDupCheck
Checks for duplicate record selection
-
Description
Prevents selecting a record that is already linked in another record of this app. Queries for records containing the selected record ID and clears selection if found. Requires dnRecLink, dnRecLinkIds, and optionally dnsRecLinkAuto to be configured.
Parameters
Name Type Description eventObject Fulcrum change event from record link field
Returns
Examples
loader.dnRecLink = 'project_link' loader.dnRecLinkIds = 'project_id_text' loader.dnsRecLinkAuto = ['project_name', 'project_date'] ON('change', 'project_link', loader.selfDupCheck) -
processSelfDupCheck
Processes duplicate check results
-
Description
Callback for selfDupCheck. If records are found that aren't the current record, clears the selection, auto fields, and shows the duplicate alert.
Parameters
Name Type Description recordsArray.<Object> Array of raw Fulcrum record objects
Returns
-
processRefreshRL
Processes refresh record link results
-
Description
Callback for refreshRecordLink. Updates the record link field with the IDs of loaded records and calls addOnRefreshRL callback.
Parameters
Name Type Description recordsArray.<Object> Array of raw Fulcrum record objects
Returns
-
refreshRecordLink
Refreshes a record link field with linked records
-
Description
Queries for records in the linked app that reference the current record (via dnRefreshRL field containing current RECORDID), then updates the record link field. Requires dnRefreshRL to be configured.
Returns
Examples
loader.dnRefreshRL = 'parent_record_link' loader.dnRecLink = 'child_records' loader.sortOrder = [['created_at', 'dsc']] -
clearAutoFields
Clears auto-populated fields
-
Description
Clears all fields listed in dnsRecLinkAuto array. Called when record link is cleared or duplicate is detected.
Returns
Methods
-
filterEmpty() → {Object}
Creates a filter object for loading all records from a form
-
Description
Returns a query object with no predicates, which loads all records.
Returns
Examples
const opts = loader.filterEmpty() loader.loadRecords(opts, myCallback) -
filterId( ids ) → {Object}
Creates a filter object for loading records by ID array
-
Description
Returns a query object that loads specific records by their IDs.
Parameters
Name Type Description idsArray.<string> Array of Fulcrum record IDs
Returns
Examples
const ids = ['abc-123', 'def-456'] const opts = loader.filterId(ids) loader.loadRecords(opts, myCallback) -
filterTemplate( dn, op, val [, order ] ) → {Object}
Creates a filter object with a single predicate
-
Description
Returns a query object with a single field filter. Common operators: "equal_to", "not_equal_to", "contains", "starts_with", "greater_than", "less_than"
Parameters
Name Type Attributes Default Description dnstring Data name of field to filter on
opstring LOADRECORDS operator (e.g., "equal_to", "contains")
valstring | number | boolean Value to filter by
orderArray.<Array> | null <optional> Optional sort order, e.g., [['date', 'dsc']]
Returns
Examples
const opts = loader.filterTemplate('status', 'equal_to', 'active') loader.loadRecords(opts, myCallback)With sort order
const opts = loader.filterTemplate('project_id', 'equal_to', 'P123', [['created_at', 'dsc']])