List of all fields within each entity with metadata about each field. Includes data types, relationships, defaults, and UI display preferences.

Hierarchy (view full)

Constructors

Properties

Accessors

Methods

Constructors

Properties

AllowDecryptInAPI: boolean = false

Controls whether encrypted fields are decrypted when returned via API.

When true:

  • Field value is decrypted before returning to client
  • Use for PII that authorized users should see

When false:

  • Behavior depends on SendEncryptedValue
  • Use for secrets like API keys that should never leave the server

Default

false (secure by default)
AllowUpdateAPI: boolean = null
AllowUpdateInView: boolean = null
AllowsNull: boolean = null
AutoIncrement: boolean = null
AutoUpdateCategory: boolean = true
  • Field Name: AutoUpdateCategory
  • Display Name: Auto Update Category
  • SQL Data Type: bit
  • Default Value: 1
  • Description: When 1, allows system/LLM to auto-update Category; when 0, user has locked this field
AutoUpdateDefaultInView: boolean = true
  • Field Name: AutoUpdateDefaultInView
  • Display Name: Auto Update Default In View
  • SQL Data Type: bit
  • Default Value: 1
  • Description: When 1, allows system/LLM to auto-update DefaultInView; when 0, user has locked this field
AutoUpdateDisplayName: boolean = true
  • Field Name: AutoUpdateDisplayName
  • Display Name: Auto Update Display Name
  • SQL Data Type: bit
  • Default Value: 1
  • Description: When 1, allows system/LLM to auto-update DisplayName during CodeGen; when 0, user has locked this field
AutoUpdateIncludeInUserSearchAPI: boolean = true
  • Field Name: AutoUpdateIncludeInUserSearchAPI
  • Display Name: Auto Update Include In User Search API
  • SQL Data Type: bit
  • Default Value: 1
  • Description: When 1, allows system/LLM to auto-update IncludeInUserSearchAPI during CodeGen; when 0, user has locked this field
AutoUpdateIsNameField: boolean = true
  • Field Name: AutoUpdateIsNameField
  • Display Name: Auto Update Is Name Field
  • SQL Data Type: bit
  • Default Value: 1
  • Description: When 1, allows system/LLM to auto-update IsNameField; when 0, user has locked this field
AutoUpdateRelatedEntityInfo: boolean = true
  • Field Name: AutoUpdateRelatedEntityInfo
  • Display Name: Auto Update Related Entity Info
  • SQL Data Type: bit
  • Default Value: 1
  • Description: Indicates whether the related entity information should be automatically updated from the database schema. When set to 0, relationships not part of the database schema can be manually defined at the application and AI agent level. Defaults to 1.
BaseTable: string = null
BaseView: string = null
Category: string = null
CodeType: "Other" | "CSS" | "HTML" | "JavaScript" | "SQL" | "TypeScript" = null
  • Field Name: CodeType
  • Display Name: Code Type
  • SQL Data Type: nvarchar(50)
  • Default Value: null
  • Value List Type: List
  • Possible Values: CSS, HTML, JavaScript, Other, SQL, TypeScript
  • Description: The type of code associated with this field. Only used when the ExtendedType field is set to 'Code'
DefaultColumnWidth: number = null
DefaultInView: boolean = null
DefaultValue: string = null
Description: string = null
DisplayName: string = null

Optional property that provides the display name for the field, if null, use the Name property. The DisplayNameOrName() method is a helper function that does this for you with a single method call.

Encrypt: boolean = false

When true, this field will be encrypted at rest using the specified EncryptionKeyID. Encrypted fields:

  • Cannot be indexed or searched effectively
  • Are automatically encrypted on save and decrypted on load
  • Store data in the format: $ENC$$$$[$]

Default

false
EncryptionKeyID: string = null

References the encryption key to use when Encrypt is true. Must point to an active record in the "MJ: Encryption Keys" entity. Required if Encrypt is true.

Entity: string = null
EntityClassName: string = null
EntityCodeName: string = null
EntityID: string = null

Foreign key to the Entities entity.

EntityIDFieldName: string = null
ExtendedType: string = null
FieldCodeName: string = null
FullTextSearchEnabled: boolean = false
GeneratedFormSection: string = null
GeneratedValidationFunctionCheckConstraint: string = null
  • Field Name: GeneratedValidationFunctionCheckConstraint
  • Display Name: Generated Validation Function Check Constraint
  • SQL Data Type: nvarchar(max)
  • Default Value: null
  • Description: If a generated validation function was generated previously, this stores the text from the source CHECK constraint in the database. This is stored so that regeneration of the validation function will only occur when the source CHECK constraint changes.
GeneratedValidationFunctionCode: string = null
  • Field Name: GeneratedValidationFunctionCode
  • Display Name: Generated Validation Function Code
  • SQL Data Type: nvarchar(max)
  • Default Value: null
  • Description: Contains the generated code for the field validation function, if it exists, null otherwise.
GeneratedValidationFunctionDescription: string = null
  • Field Name: GeneratedValidationFunctionDescription
  • Display Name: Generated Validation Function Description
  • SQL Data Type: nvarchar(max)
  • Default Value: null
  • Description: Contains a description for business users of what the validation function for this field does, if it exists.
GeneratedValidationFunctionName: string = null
  • Field Name: GeneratedValidationFunctionName
  • Display Name: Generated Validation Function Name
  • SQL Data Type: nvarchar(255)
  • Default Value: null
  • Description: Contains the name of the generated field validation function, if it exists, null otherwise.
ID: string = null

Primary Key

IncludeInGeneratedForm: boolean = null
IncludeInUserSearchAPI: boolean = null
IncludeRelatedEntityNameFieldInBaseView: boolean = null
IsFloat: boolean
IsNameField: boolean = null
IsPrimaryKey: boolean = null

If true, the field is the primary key for the entity. There must be one primary key field per entity.

IsUnique: boolean = null

If true, the field is a unique key for the entity. There can be zero to many unique key fields per entity.

IsVirtual: boolean = null
Length: number = null
Name: string = null
Precision: number = null
RelatedEntity: string = null
RelatedEntityBaseTable: string = null
RelatedEntityBaseView: string = null
RelatedEntityClassName: string = null
RelatedEntityCodeName: string = null
RelatedEntityDisplayType: "Search" | "Dropdown" = null
RelatedEntityFieldName: string = null
RelatedEntityID: string = null
RelatedEntityNameFieldMap: string = null
RelatedEntitySchemaName: string = null
Scale: number = null
SchemaName: string = null
ScopeDefault: string = null
  • Field Name: ScopeDefault
  • Display Name: Scope Default
  • SQL Data Type: nvarchar(100)
  • Description: A comma-delimited string indicating the default scope for field visibility. Options include Users, Admins, AI, and All. Defaults to All when NULL. This is used for a simple method of filtering field defaults for visibility, not security enforcement.
SendEncryptedValue: boolean = false

When AllowDecryptInAPI is false, controls what value is returned to clients.

When true:

  • Send the encrypted ciphertext ($ENC$...)
  • Client knows field is encrypted but can't decrypt

When false:

  • Send NULL instead of the encrypted value
  • Most secure option - client doesn't even see encrypted data

Default

false (most secure)
Sequence: number = null

The sequence of the field within the entity, typically the intended display order

Status: "Active" | "Disabled" | "Deprecated" = 'Active'
  • Field Name: Status
  • Display Name: Status
  • SQL Data Type: nvarchar(25)
  • Default Value: Active
  • Value List Type: List
  • Possible Values
    • Active
    • Deprecated
    • Disabled
  • Description: Current status of the entity field - Active fields are available for use, Deprecated fields are discouraged but still functional, Disabled fields are not available for use
Type: string = null
UserSearchParamFormatAPI: string = null
ValueListType: string = null
ValuesToPackWithSchema: "None" | "Auto" | "All" = 'Auto'
  • Field Name: ValuesToPackWithSchema
  • Display Name: Values To Pack With Schema
  • SQL Data Type: nvarchar(10)
  • Default Value: Auto
  • Value List Type: List
  • Possible Values
    • Auto
    • None
    • All
  • Description: Determines whether values for the field should be included when the schema is packed. Options: Auto (include manually set or auto-derived values), None (exclude all values), All (include all distinct values from the table). Defaults to Auto.
ViewCellTemplate: string = null
_EntityFieldValues: EntityFieldValueInfo[]
_RelatedEntityNameFieldIsVirtual: boolean
_RelatedEntityNameFieldMap: string
_RelatedEntityTableAlias: string
__mj_CreatedAt: Date = null
__mj_UpdatedAt: Date = null
_codeName: string = null

For fields in the database that have characters invalid for SQL identifiers in them, we need to replace those characters with _ in order to create variables for stored procedures. This property returns a consistent CodeName you can use everywhere to refer to the field when generated variable names

SQL_CURRENT_DATE_FUNCTIONS: readonly string[] = ...

Readonly array of SQL Server date/time functions that return the current date/time

Accessors

  • get IsCreatedAtField(): boolean
  • Returns true if the field is the CreatedAt field, a special field that is used to track the creation date of a record. This is only used when the entity has TrackRecordChanges=1

    Returns boolean

  • get IsDeletedAtField(): boolean
  • Returns true if the field is the DeletedAt field, a special field that is used to track the deletion date of a record. This is only used when the entity has DeleteType=Soft

    Returns boolean

  • get IsSpecialDateField(): boolean
  • Helper method that returns true if the field is one of the special reserved MJ date fields for tracking CreatedAt and UpdatedAt timestamps as well as the DeletedAt timestamp used for entities that have DeleteType=Soft. This is only used when the entity has TrackRecordChanges=1 or for entities where DeleteType=Soft

    Returns boolean

  • get IsUpdatedAtField(): boolean
  • Returns true if the field is the UpdatedAt field, a special field that is used to track the last update date of a record. This is only used when the entity has TrackRecordChanges=1

    Returns boolean

  • get NeedsQuotes(): boolean
  • Returns true if the field type requires quotes around the value when used in a SQL statement

    Returns boolean

  • get RequiredUnicodePrefix(): boolean
  • Returns true if the field type requires a Unicode prefix (N) when used in a SQL statement.

    Returns boolean

  • get SQLFullType(): string
  • Returns a string with the full SQL data type that combines, as appropriate, Type, Length, Precision and Scale where these attributes are relevant to the Type

    Returns string

  • get SkipValidation(): boolean
  • Returns true if the field is a "special" field (see list below) and is handled inside the DB layer and should be ignored in validation by the BaseEntity architecture Also, we skip validation if we have a field that is:

    • the primary key
    • an autoincrement field
    • the field is virtual
    • the field is readonly
    • the field is a special date field

    Returns boolean

  • get UnicodePrefix(): string
  • Returns the Unicode prefix (N) if the field type requires it, otherwise returns an empty string.

    Returns string

Methods

  • Formats a value based on the parameters passed in. This is a wrapper utility method that already know the SQL type from the entity field definition and simply calls the generic FormatValue() function that is also exported by @memberjunction/core

    Parameters

    • value: any

      Value to format

    • decimals: number = 2

      Number of decimals to show, defaults to 2

    • currency: string = 'USD'

      Currency to use when formatting, defaults to USD

    • maxLength: number = 0

      Maximum length of the string to return, if the formatted value is longer than this length then the string will be truncated and the trailingChars will be appended to the end of the string

    • trailingChars: string = "..."

      Only used if maxLength is > 0 and the string being formatted is > maxLength, this is the string that will be appended to the end of the string to indicate that it was truncated, defaults to "..."

    Returns string

    either the original string value or a formatted version. If the format cannot be applied an an exception occurs it is captured and the error is put to the log, and the original value is returned

  • Copies initialization data from a plain object to the class instance. Only copies properties that already exist on the class to prevent creating new fields. Special handling for DefaultValue fields to extract actual values from SQL Server syntax.

    Parameters

    • initData: any

      The initialization data object

    Returns void

  • This static factory method is used to check to see if the entity field in question is active or not If it is not active, it will throw an exception or log a warning depending on the status of the entity field being either Deprecated or Disabled.

    Parameters

    • entityField: EntityFieldInfo

      the EntityFieldInfo object to check the status of

    • callerName: string

      the name of the caller that is calling this method, used for logging purposes such as EntityField::constructor as an example.

    Returns void

  • Checks if a default value is a SQL Server function that returns the current date/time

    Parameters

    • defaultValue: string

      The default value to check

    Returns boolean

    true if the default value is a SQL current date/time function, false otherwise