Skip to content

Record

The Record class represents a basic entity in NodeActa system described by attributes and optionally files. This class allows users to interact with and manage records, including checking out, saving, deleting, and granting access rights.

  • baseClass: <CLASS> (static)
    The base class of the data class this record belongs to. For example: data class Data has the base class Record, data class DataClass has the base class Data,etc.
  • rootClass: <CLASS> (static)
    The root class of the data class this record belongs to. Root class is the one that does not have baseClass.
  • dataClass: __Class (static)
    Internal data class definition.
    Note: This is not the same type as baseClass, rootClass or DataClass object.
  • editorApp: <APP> (static)
    The app class system uses it to edit this record.
  • searchApp: <APP> (static)
    The app class system uses to search records of this record's data class.
  • attributesLayout: Attributes
    The definition of default AttributesView control layout defined on data class record belongs to.
  • id: string (read-only)
    The unique identifier of the record.
  • createdOn: Date (read-only)
    Returns the creation date of the record.
  • modifiedOn: Date (read-only)
    Returns the last modified date of the record.
  • hash: string
    Gets or sets the hash value of the record.
  • reference: string
    Gets or sets the reference of the record.
  • referenceDate: Date
    Gets or sets the reference date of the record.
  • commands: Command[]
    A list of commands available for a record. These commands can be defined in data class script with property get commands(): Command[]
  • creator: Grantee
    The creator of the record.
  • owner: Grantee
    The owner of the record.
  • modifier: Grantee
    The user who last modified the record.
  • notes: Notes
    The collection of notes associated with this record.
  • masterRecord: Record
    The master record that this record is linked to. This is handy when processing data classes with details. This record belongs to a detail-data class.
  • isAccessed: boolean
    Indicates whether the record has been accessed by currently logged user. This is handy with data classes that have 'Access Monitoring' option enabled (see DataClass options). Record is marked as accessed if markAsRead() is called.
  • isAccessedButModified: boolean
    Indicates markAsRead() was called, but record's files have been modified afterward.
  • isNew: boolean
    Indicates if the record is new.
  • isModified: boolean
    Indicates if the record has been modified.
  • isChanged: boolean
    A computed value indicating if the record is either new or modified.
  • isDeleted: boolean
    Indicates if the record has been deleted.
  • isFilesChangedLocally: boolean
    Indicates if the files associated with this record have been changed locally (whether or not the record is checked out).
  • isLocked: boolean
    Indicates whether the record is exclusively locked (method lock() was called).
  • isFinalized: boolean
    Indicates if the record has been finalized (no further changes are allowed).
  • isDocument: boolean
    Indicates if the record is of a document data class (if data class has 'Has files' option enabled).
  • isCustomClass: boolean
    Custom class has defined custom SQLs for select/update/delete records.
  • isMemoryClass: boolean
    Indicates if the record is of a data class that does not have database representation. It is used for temporary data storage.
  • hasSecurity: boolean
    Indicates if the record is of a data class with enabled 'Security' option. Each record of this class can have defined access permissions.
  • hasDetails: boolean
    Indicates if the record is of data class with enabled 'Has details' option.
  • hasFileIntegrity: boolean
    Indicates if the record is of a data class with enabled 'Hash-check files' option. After each file archiving, file content hash is calculated and saved in the database. When accessing files of this data class, file hash is always checked and if hashes do not match error is displayed.
  • hasRecordIntegrity: boolean
    Indicates if the record is of a data class with enabled 'Hash-check record' option. After each record is saved, record field values hash is calculated and saved in the database. To verify record integrity, you can call record.checkIntegrity().
    Note: Record integrity check is not done automatically.
  • checkIntegrity: boolean
    Checks if integrity of the record is violated. Data class must have enabled 'Hash-check record' option. Note: Record integrity check is not done automatically.
  • canFinalize: boolean
    Indicates if the record can be finalized.
  • isCheckedOut: boolean
    Indicates if the record is currently checked out.
  • isCheckedOutByMe: boolean
    Indicates if the record is checked out by the current user.
  • isCheckedOutNOTByMe: boolean
    Indicates if the record is checked out by another user.
  • checkedOutBy: Grantee
    The user who has checked out the record.
  • canCheckOut: boolean
    Indicates if the record can be checked out.
  • canCheckUndoOut: boolean
    Indicates if the check-out operation can be undone.
  • canCheckIn: boolean
    Indicates if the record can be checked in.
  • files: DocumentFiles
    The files associated with this record (if data class has 'Has files' option enabled).
  • versionCreator: Grantee
    The user who created the current version of the record (if data class has 'Has files' option enabled) .
  • versionDate: Date
    The date of the current version (if data class has 'Has files' option enabled).
  • versionMajor: number
    The major version number (if data class has 'Has files' option enabled).
  • versionMinor: number
    The minor version number (if data class has 'Has files' option enabled).
  • versions: Records
    The list of versions of the record (if data class has 'Has files' option enabled).

Static Methods:

  • as(alias: string): CLASS
    Returns the data class's alias, which can be used when joining the same data class multiple times in the same query.
  • join(dataClass: CLASS): Query<CLASS>
    Performs an inner join with the specified data class.
  • joinLeft(dataClass: CLASS): Query<CLASS>
    Performs a left join with the specified data class.
  • joinRight(dataClass: CLASS): Query<CLASS>
    Performs a right join with the specified data class.
  • joinFull(dataClass: CLASS): Query<CLASS>
    Performs a full join with the specified data class.
  • query(): Query<CLASS>
    Creates a Query object to fetch or filter data records.
  • where(field: string | Field, op: WhereOperator, value?: any, case_ins?: boolean): Query<CLASS>
    Adds a WHERE clause to the query to filter records based on a condition.
  • whereExists(subQuery: Query): Query<CLASS>
    Adds a WHERE EXISTS clause to the query using a sub-query.
  • having(field: string | Field, op: WhereOperator, value?: any, case_ins?: boolean): Query<CLASS>
    Adds a HAVING clause to filter records after aggregation.
  • orderBy(field: string | Field, order?: SortOrder): Query<CLASS>
    Orders the result set by the specified field and order.
  • groupBy(field: string | Field): Query<CLASS>
    Groups the result set by the specified field.
  • limit(limit: number): Query<CLASS>
    Limits the number of records returned by the query.
  • offset(offset: number): Query<CLASS>
    Sets the offset for the query, specifying how many records to skip before starting to return results.
  • select(...fields: (string | Field)[]): CLASSs
    Synchronously selects specific fields from the CLASS records.
  • selectAsync(...fields: (string | Field)[]): Promise<CLASS>
    Asynchronously selects specific fields from the CLASS records.
  • selectDistinct(...fields: (string | Field)[]): CLASSs
    Selects distinct fields from the CLASS records.
  • selectDistinctAsync(...fields: (string | Field)[]): Promise<CLASS>
    Asynchronously selects distinct fields from the Data records.
  • not: Query<CLASS>
    Negates the query condition.
  • openBracket: Query<CLASS>
    Opens a bracket in the query to group conditions.

Example using query method described above to query contracts from data class Contract:

var my_contrs = 
    await Contract. 
        where(Contract.amount, WhereOperator.GreaterThan, 125000).and  
        where(Contract.remain, WhereOperator.LessThan, 25000).  
        orderBy(Contract.remain, SortOrder.Desc)
        selectAsync(Contract.id, Contract.party, Contract.amount);

Methods:

  • save()
    Saves the current record and commits changes (including detail records and files).
  • saveAsync(): Promise
    Asynchronous version of save() method. Although, javascript engine is single threaded, this method executes save in a separate thread.
  • delete()
    Deletes the record.
  • detach()
    Detaches the record from its current context.
  • copyFrom(source: Record)
    Copies data from another record into this one.
  • cancel()
    Cancels all unsaved modifications to the record.
  • lock()
    Exclusively locks the record. Only one user at one moment can exclusively lock a record. While a record is locked, other users cannot modify it. Lock will automatically expire after 15 minutes.
  • unlock()
    Release exclusive locks of the record. User can unlock only records you have locked. Administratos can release all exclusive locks via System Management→Locked Records app.
  • markAsRead()
    Marks the record as read (accessed).
  • markAsUnRead()
    Marks the record as unread (not accessed).
  • checkRight(right: string): boolean
    Checks if a specific right is granted for the current record.
  • checkOut()
    Checks out the record.
  • undoCheckOut()
    Undoes the check-out operation.
  • checkIn(comment?: string, versionMajor?: number, versionMinor?: number)
    Checks in the record with an optional comment, and optional version major and minor numbers. If major and minor parameters are not specified, system will automatically increment version number (for example: 2.4 => 2.5)
  • finalize()
    Finalizes the record. Finalized record cannot be changed any more.