API Reference > imodeljs-backend > iModels > IModelDb > IModelDb.Elements > queryElementIdByCode queryElementIdByCode Method Query for the Id of the element that has a specified code. This method is for the case where you know the element's Code. If you only know the code value, then in the simplest case, you can query on that and filter the results. In the simple case, call IModelDb.queryEntityIds, specifying the code value in the where clause of the query params. Or, you can execute an ECSQL select statement. See frequently used ECSQL queries for an example. queryElementIdByCode(code: Code): undefined | string throws IModelError if the code is invalid Parameter Type Description code Code The code to look for Returns - undefined | string The element that uses the code or undefined if the code is not used. Defined in core/backend/src/IModelDb.ts Line 1613 Last Updated: 11 June, 2024