Reference a record.
const recordLink = {
entity: "alice.baq.run",
recordId: "012a494c14154f2c91e35f34e077e5be",
};
new(entity: Entity, recordId: RecordId)
: RecordLink
toKey(recordLink: RecordLink)
: RecordKey
isRecord(record: Record, recordLink: RecordLink)
: boolean
entity
Entity
originalEntity
Entity optional
recordId
RecordId
Once created, a record link can be used in the content of a record that accepts a link of the same type. In this example, we create a Folder record with another folder as parent
.
import {Record} from "@baqhub/sdk";
import {FolderRecord} from "./baq/folderRecord.js";
function createSubFolder(entity, name, parent) {
const parentLink = Record.toLink(parent);
return FolderRecord.new(entity, {
name,
parent: parentLink,
});
}