insert Method


insert(txn, codeSpec) @beta

Add a new CodeSpec to the iModel.

insert(txn: EditTxn, codeSpec: CodeSpec): string

@returns The Id of the persistent CodeSpec.

@note If successful, this method will assign a valid CodeSpecId to the supplied CodeSpec

@throws IModelError if the insertion fails

Parameter Type Description
txn EditTxn The active EditTxn.
codeSpec CodeSpec The CodeSpec to insert

Returns - string

The Id of the persistent CodeSpec.



insert(txn, name, properties) @beta

Add a new CodeSpec to the iModel.

insert(txn: EditTxn, name: string, properties: CodeScopeSpec.Type | CodeSpecProperties): string

@returns The Id of the persistent CodeSpec.

@throws IModelError if the insertion fails

Parameter Type Description
txn EditTxn The active EditTxn.
name string The name for the new CodeSpec.
properties CodeScopeSpec.Type | CodeSpecProperties The properties of the CodeSpec. For backwards compatibility this may also be a CodeScopeSpec.Type.

Returns - string

The Id of the persistent CodeSpec.



insert(codeSpec)

Deprecated  in 5.1.9 - will not be removed until after 2026-08-04. Use CodeSpecs.insert(txn, codeSpec) instead.

Add a new CodeSpec to the iModel.

insert(codeSpec: CodeSpec): string

@returns The Id of the persistent CodeSpec.

@note If successful, this method will assign a valid CodeSpecId to the supplied CodeSpec

@throws IModelError if the insertion fails

Parameter Type Description
codeSpec CodeSpec The CodeSpec to insert

Returns - string

The Id of the persistent CodeSpec.



insert(name, properties)

Deprecated  in 5.1.9 - will not be removed until after 2026-08-04. Use CodeSpecs.insert(txn, ...) instead.

Add a new CodeSpec to the IModelDb.

insert(name: string, properties: CodeScopeSpec.Type | CodeSpecProperties): string

@returns The Id of the persistent CodeSpec.

@throws IModelError if the insertion fails

Parameter Type Description
name string The name for the new CodeSpec.
properties CodeScopeSpec.Type | CodeSpecProperties The properties or the CodeSpec. For backwards compatibility this may also be a CodeScopeSpec.Type.

Returns - string

The Id of the persistent CodeSpec.


Defined in

Last Updated: 09 May, 2026