API Reference > imodeljs-backend > iModels > IModelDb > IModelDb.Elements > tryGetElement tryGetElement Method Get an element by Id, FederationGuid, or Code tryGetElement<T extends Element<T>>(elementId: string | Code | ElementLoadProps, elementClass?: EntityClassType<Element>): undefined | T throws IModelError if the element exists, but cannot be loaded. note Useful for cases when an element may or may not exist and throwing an Error would be overkill. see IModelDb.Elements.getElement Parameter Type Description elementId string | Code | ElementLoadProps either the element's Id, Code, or FederationGuid, or an ElementLoadProps elementClass EntityClassType<Element> Optional class to validate instance against. This parameter can accept abstract or concrete classes, but should be the same as the template (T) parameter. Returns - undefined | T The element or undefined if the element is not found or fails validation when elementClass is specified. Defined in core/backend/src/IModelDb.ts Line 1585 Last Updated: 11 June, 2024