insert MethodStatic


insert(txn, sourceId, targetId) @beta

Insert a new instance of the Relationship using an explicit transaction.

insert(txn: EditTxn, sourceId: string, targetId: string): string

@returns The Id of the inserted Relationship.

Parameter Type Description
txn EditTxn The EditTxn used to perform the insert.
sourceId string The sourceId of the relationship, that is, the driver element
targetId string The targetId of the relationship, that is, the driven element

Returns - string

The Id of the inserted Relationship.



insert(iModel, sourceId, targetId)

Deprecated  Use ElementRefersToElements.insert(txn, ...) instead, within an explicit EditTxn scope (or via withEditTxn). See EditTxn documentation for migration help.

Insert a new instance of the Relationship.

insert(iModel: IModelDb, sourceId: string, targetId: string): string

@returns The Id of the inserted Relationship.

Parameter Type Description
iModel IModelDb The iModel that will contain the relationship.
sourceId string The sourceId of the relationship, that is, the driver element.
targetId string The targetId of the relationship, that is, the driven element.

Returns - string

The Id of the inserted Relationship.


Defined in

Last Updated: 25 April, 2026