Private _currentPrivate _latestPrivate capturePrivate convertPrivate createPrivate createPrivate customReadonly dataUtility methods for working with the workspace's data model at runtime.
Provides helpers such as getRelationDefinition() and isConstrainingRelation()
for navigating fact sheet type definitions, field definitions, and relation structures.
The data model itself is available via lx.currentSetup.settings.dataModel.
Private doPrivate encodePrivate encodePrivate encodePrivate getPrivate getPrivate latestPrivate latestPrivate latestPrivate messengerPrivate mountPrivate mountPrivate mountPrivate mountPrivate mountPrivate mountPrivate mountPrivate mountPrivate mountPrivate mountPrivate mountPrivate mountPrivate mountPrivate mountPrivate mountUIButtonPrivate mountUIElementsPrivate mountUISelectionPrivate mountUISelectionPrivate replacePrivate sanitizePrivate setupPrivate translatePrivate validatePrivate waitGetter to receive the current state of the report setup. The object is only available if the report already called a successful init() LxCustomReportLib.init.
Returns the last value that was passed to LxCustomReportLib.publishState.
Useful for reading the current report state synchronously without subscribing to events.
Returns null until LxCustomReportLib.publishState has been called at least once.
Execute a custom GraphQL query or mutation against the LeanIX GraphQL API.
GraphQL query or mutation string
Optional variables: stringGraphQL variables as a JSON-serialized string (not a plain object).
Use JSON.stringify({ myVar: 'value' }) to produce the correct format.
Optional trackingKey: stringOptional identifier used for backend analytics and performance tracking. Has no effect on the query result or response shape.
A promise that resolves to the data field of the GraphQL response (e.g.
{ allFactSheets: { edges: [...] } }). GraphQL errors are not thrown — check the
response structure if queries return unexpected results.
lx.executeGraphQL(`{
allFactSheets(factSheetType: ITComponent) {
edges {
node {
id
name
type
description
}
}
}
}`)
// With variables (must be JSON-serialized)
lx.executeGraphQL(
`mutation ($name: String!, $tagGroupId: ID) {
createTag(name: $name, tagGroupId: $tagGroupId) { id }
}`,
JSON.stringify({ name: 'MyTag', tagGroupId: 'uuid-here' })
)
Allows making XHR requests through the parent frame's origin, bypassing the same-origin restriction that applies to code running inside a report iframe.
The HTTP method. GET is always permitted. POST and PUT are
permitted only for a restricted subset of workspace REST API paths — not every
endpoint is available. Attempting an unsupported path will result in an error response.
Relative URL for the request (e.g. '/services/pathfinder/v1/...').
The path is resolved against the workspace base URL.
Optional body: anyOptional request body for POST and PUT requests. Defaults to {}.
Optional responseType: "text" | "blob"Expected response type. Use 'blob' for binary responses (e.g.
file downloads). Defaults to 'text'.
Optional extendedHandling: booleanWhen true, adds the x-gateway-handle-request: EXTENDED
header, required by certain endpoints such as the hierarchy API. Defaults to false.
A promise that resolves to the response data (string or Blob depending on
responseType).
// Fetch workspace data via REST
lx.executeParentOriginXHR('GET', '/services/pathfinder/v1/factSheets?type=Application')
.then(response => console.log(response));
Returns a formatted currency number according to the users currency settings.
Value to be formatted
Optional minimumFractionDigits: numberMinimum number of digits to use for the fraction
Optional compact: booleanDefines whether to show compact display
Optional locale: stringDefines locale info 'de-DE', 'en-EN'
Optional maximumFractionDigits: numberMaximum number of digits to use for the fraction. When specified, restricts the number of decimal places shown (useful for rounding).
Currency string
lx.formatCurrency(123.50, 2) => '€123.50'
lx.formatCurrency(12333.50, 0, true) => '€12K'
lx.formatCurrencyWithoutCode(10255, 0, true, undefined, 1) => '€10.3K'
lx.formatCurrency(1288893.50, 2, true, 'de-DE') => '1,29 Mio. €'
Get all Fact Sheets of a given type from the GraphQL endpoint, optionally projected across multiple points of view (e.g. current state vs. post-transformation state).
The Fact Sheet type to query (e.g. 'Application', 'ITComponent').
Descriptors for the fields to include on each returned Fact Sheet node.
Each descriptor has a type discriminator:
'field' — a direct field on the Fact Sheet (e.g. businessCriticality)'relationField' — a field that lives on a relation edge (e.g. technicalSuitability
on relApplicationToITComponent)'targetField' — a field on the Fact Sheet at the other end of a relationFilter definition for which Fact Sheets to return. When
compositeFacets is present it takes precedence over the regular facets array.
Use the same facet selection shape as provided by ReportFacetsConfig.callback.
A record mapping arbitrary string keys to GraphQLPointOfViewInput
objects. Each key becomes a top-level key in the ReportAllFactSheetsResponse,
and its value defines the transformation scope (factSheetIds + pointInTime).
Pass { current: { factSheetIds: [], pointInTime: { date: null, milestoneId: null } } }
to query the current workspace state only.
Optional options: GraphQLOptionsOptional query modifiers:
includeInvalidRelations — include relations that violate data model constraintsexcludeConstrainingRelations — relation names to exclude from constraining logictrackingKey — analytics identifier for the query (no effect on results)getOnlyBaseAttributes — restrict response to BaseFactSheet fields onlyA promise resolving to ReportAllFactSheetsResponse — a record keyed by
the same keys as pointsOfView, each containing totalCount and an edges array of
Fact Sheet nodes with the requested attributes.
lx.getAllFactSheets(
'Application',
[{ type: 'field', name: 'lifecycle', field: 'lifecycle', fieldType: 'LIFECYCLE' }],
{ facets: [], directHits: [] },
{ current: { factSheetIds: [], pointInTime: { date: null, milestoneId: null } } }
).then(response => {
const apps = response.current.edges.map(e => e.node);
});
Returns the configured or default meta data for a field at a Fact Sheet.
Meta data includes display colors (bgColor, color) and icons for each possible
field value, as configured in the workspace's view model.
Always use workspace-defined colors rather than hardcoding values, so that reports remain visually consistent with the LeanIX application.
Fact Sheet type
Name of a Fact Sheet field or relation
Meta data
lx.getFactSheetFieldMetaData('Application', 'functionalSuitability')
// Returns:
// {
// values: {
// perfect: {
// bgColor: '#fff',
// color: '#000'
// }
// ...
// }
// }
// Getting the actual background color for a field value:
lx.getFactSheetFieldMetaData('Application', 'functionalSuitability').values['perfect'].bgColor
Returns the configured or default meta data for a field of a Fact Sheet relation.
Fact Sheet type
Name of the directed relation
Name of a field on the relation
Meta data
lx.getFactSheetRelationFieldMetaData('Application', 'relApplicationToITComponent', 'technicalSuitability')
// Returns:
// {
// values: {
// fullyAppropriate: {
// bgColor: '#fff',
// color: '#000'
// }
// ...
// }
// }
// Getting the actual background color for a field value:
lx.getFactSheetRelationFieldMetaData(
'Application',
'relApplicationToITComponent',
'technicalSuitability'
).values['perfect'].bgColor
Get the current filter result — the latest set of Fact Sheet nodes delivered by the active facet callback.
The returned array has the same shape as the data argument passed to
ReportFacetsConfig.callback: an array of Fact Sheet objects containing the fields
specified in ReportFacetsConfig.attributes. Returns an empty array ([]) until the
first facet result has been received from the framework.
Current facet result — array of Fact Sheet nodes, or [] if no result yet
Beta Get a list of measurements from the metrics service.
Optional nameOnly: booleanSet this to true to receive only the measurement names
A promise that resolves to an array of measurements
Beta Get projections from the impact service.
A "point of view" represents a specific point in time — either the current state of the workspace or the projected state after a set of planned changes (e.g. an initiative or transformation) has been applied. Requesting multiple points of view returns one result set per POV, enabling before/after comparisons.
Descriptors for the Fact Sheet attributes to include in each projection
item. Each descriptor has a type discriminator: 'field' for direct Fact Sheet fields,
'relationField' for fields on a relation, 'targetField' for fields on the related
Fact Sheet, 'path' for nested traversal, or 'timing' for timeline metadata.
Filter conditions to scope which Fact Sheets are included in the projection. Supports equality, range, full-text, fact sheet type, and relation-based filters.
One or more points of view to project. Each entry has an id and an
optional changeSet that defines the plan or date to project into.
A promise resolving to ProjectionsResponse — an array of
PointOfViewResponse objects, one per requested point of view, each containing the
projected Fact Sheet items with the requested attributes.
lx.getProjections(
[{ type: 'field', name: 'lifecycle', field: 'lifecycle' }],
[{ type: 'factSheetType', types: ['Application'] }],
[{ id: 'current' }, { id: 'after-plan', changeSet: { type: 'plan', planId: 'uuid' } }]
).then(response => {
response.data.forEach(pov => console.log(pov.id, pov.items));
});
This method allows reports to check on users' workspace permissions. Therefore, reports can enable features according to given workspace permissions. See: [Authorization Model]https://docs-eam.leanix.net/docs/authorization-model
Shiro permissions string array to check (example: ['BOOKMARKS:CREATE:VISUALIZER', 'BOOKMARKS:CREATE:REPORTS'] creation of diagram bookmarks)
Promise resolving to a Record<string, boolean> where each key is one of the
requested permission strings and the value indicates whether the current user holds
that permission (true) or not (false).
@deprecated. UI Elements are created or removed on ReportConfiguration.ui.
Hide the button shown via LxCustomReportLib.showEditToggle.
Hide the spinner that was previously shown via LxCustomReportLib.showSpinner.
Starts initialisation of the reporting framework. Returns a promise which is resolved once initialisation with the framework is finished. The resolved promise contains a ReportSetup instance with information provided to you through the framework.
This method must be called first and its promise must be resolved before using all other methods in this library (such as metadata methods, navigation methods, etc.).
With that information you should be able to set up your report properly. Once that is done the LxCustomReportLib.ready function needs be called to signal that the report is ready to receive and process data and user events.
A promise that resolves to the ReportSetup object
Check if a given feature is enabled for the current workspace.
Features come in two types:
FUNCTIONAL — binary toggle; enabled when status === 'ENABLED'.QUOTA — capacity-based; enabled when quota !== 0.Feature IDs are workspace-plan-dependent and defined by the LeanIX platform (e.g.
'BTM', 'AI_INSIGHTS'). An unknown or unrecognized featureId always resolves
to false.
Identifier of the feature to check (e.g. 'BTM', 'AI_INSIGHTS').
A promise that resolves to true if the feature is enabled, false otherwise.
Navigate to inventory using provided filters.
This method allows reports to programmatically navigate to the inventory view with specific filters applied. Filters can include facet-based filtering (e.g., fact sheet types, lifecycle, tags) and/or filtering by specific fact sheet IDs.
Specified filters will be applied to inventory
// Filter by fact sheet type and lifecycle phase
lx.navigateToInventory({
facetFilters: [
{ facetKey: 'FactSheetTypes', keys: ['Application'] },
{ facetKey: 'lifecycle', keys: ['active', 'phaseIn'] }
]
});
// Filter by specific fact sheet IDs
lx.navigateToInventory({
facetFilters: [
{ facetKey: 'FactSheetTypes', keys: ['Application'] }
],
factSheetIds: ['uuid-1234-5678', 'uuid-abcd-efgh', 'uuid-9876-5432']
});
Show a customisable configuration dialog to the user, in which the user can adjust report settings.
An object containing the form fields to be displayed in this dialog.
An object with the same keys as fields containing the initial values of those fields.
Optional update: ((form) => FormModal)Optional callback invoked each time the user changes any field value. See the LxCustomReportLib.openFormModal overload that accepts a FormModal for full details.
A promise that resolves to the configuration confirmed by the user or to false if the user canceled the configuration
const fields = {
level: {
type: 'SingleSelect',
label: 'Level to be displayed',
options: [
{ value: '1', label: 'First level' },
{ value: '2', label: 'Both levels' }
]
},
hideEmpty: {
type: 'Checkbox',
label: 'Hide empty elements'
}
};
const initialValues = {
level: '2',
hideEmpty: false
};
lx.openFormModal(fields, initialValues).then((values) => {
if (values) {
console.log('Selection:', values.level, values.hideEmpty);
} else {
console.log('Selection cancelled');
}
});
Show a customisable configuration dialog to the user, in which the user can adjust report settings.
An object FormModal containing the form fields, values, optional messages and optional valid flag.
Optional update: ((form) => FormModal)Optional callback invoked each time the user changes any field value in the dialog.
Receives the current FormModal state and must return the (potentially modified)
FormModal to render. Use it to implement conditional field visibility, cross-field
validation messages, or to update valid to control whether the confirm button is enabled.
A promise that resolves to the configuration confirmed by the user or to false if the user canceled the configuration
const fields = {
level: {
type: 'SingleSelect',
label: 'Level to be displayed',
options: [
{ value: '1', label: 'First level' },
{ value: '2', label: 'Both levels' }
]
},
hideEmpty: {
type: 'Checkbox',
label: 'Hide empty elements'
}
};
const values = {
level: '2',
hideEmpty: false
};
const messages = {
level: {type: 'error', message:'example message'}
}
const update = (formModal: lxr.FormModal): lxr.FormModal => {return createFormModal()}
lx.openFormModal({fields, values, messages, valid: true}, updated).then((values) => {
if (values) {
console.log('Selection:', values.level, values.hideEmpty);
} else {
console.log('Selection cancelled');
}
});
This method allows you to open any link in a new browser tab. Only Chrome and Safari allows you to open a new tab out of an iframe. Since reports run inside an iframe, they are not allowed to open links in other browsers. Therefore, the framework allows you to request to open a link. This will show a popup box outside the iframe containing the link. The user can click on it in order to open the link in a new tab.
It is not possible to directly open the link outside the iframe, since some browsers (e.g. Firefox) show a popup warning whenever a link is opened via a message coming from an iframe.
Link-URL
Optional _target: string_target (target is ignored due to new popup behavior)
lx.openLink(this.baseUrl + '/factsheet/Application/28fe4aa2-6e46-41a1-a131-72afb3acf256');
// The baseUrl can be found in the setup returned by lx.init() like this:
// lx.init().then(setup => { this.baseUrl = setup.settings.baseUrl });
Beta Opens a new instance of the current report in a separate browser tab, pre-seeded with the provided state and facet selection.
Serialization requirement: state follows the same JSON-serializable constraint
as LxCustomReportLib.publishState — it becomes the savedState of the newly
opened report instance.
Custom report state for the new tab, subject to the same JSON-serializable constraints as LxCustomReportLib.publishState.
Initial facet filter selection for the new tab. Typically obtained
from UISelection.facets inside the ui.update callback defined in
ReportConfiguration.ui.
Optional name: stringOptional display name pre-filled in the new tab's report header. Falls back to the default report name if not provided.
Opens an overlaying side pane next to the report, populated with the provided elements. Focus is automatically returned to the previously focused element when the side pane is closed.
A record mapping element IDs to SidePaneElement objects.
Supported element types include Container, Table, FactSheet, FactSheetTable,
Badge, Description, ShowInventory, CategoryHeader, and ContextMenu.
Optional update: ((factSheetUpdate) => void)Optional callback invoked whenever the user edits a field or relation
inside the side pane (e.g. via an inline FactSheet element). Receives a
FactSheetUpdate describing the changed field or relation. Use this to persist
changes back to the workspace via lx.executeGraphQL().
Optional onClick: ((sidepaneClick) => void)Optional callback invoked when the user clicks a clickable element in the
side pane (e.g. a Description element with a clickId, or a ContextMenu entry of
type 'Click'). Receives a SidePaneClick containing the clickId of the
element that was clicked.
lx.openSidePane(
{
header: { type: 'CategoryHeader', label: 'My Application' },
details: {
type: 'FactSheet',
factSheetId: 'uuid-here',
factSheetType: 'Application',
detailFields: ['description', 'businessCriticality'],
relations: [],
pointOfView: { id: 'current' }
}
},
(update) => console.log('Field updated:', update),
(click) => console.log('Clicked:', click.id)
);
Publishes the report's current internal state to the framework so it can be persisted when the user saves a report configuration (bookmark). When that configuration is restored, the saved state is passed back via ReportSetup.savedState in the promise returned by LxCustomReportLib.init.
Serialization requirement: state must be JSON-serializable (no functions, class
instances, or circular references). The framework serializes it with JSON.stringify
before persisting.
Custom report state to persist. Accessible afterwards via LxCustomReportLib.latestPublishedState.
Signals that the custom report is ready. A configuration must be provided to tell the framework about the requirements of the report (most importantly which data it needs). The provided configuration acts as an interface between the report code and the report framework.
Optional configuration: ReportConfigurationConfiguration object
Show a dialog to the user to select one or more Fact Sheets.
Configures the Fact Sheet selection dialog.
A promise that resolves to:
false if the user dismissed or cancelled the dialogconfig.mode is 'SINGLE'config.mode is 'MULTIPLE' Each Fact Sheet object contains the fields listed in config.attributes.
@deprecated. UI Elements are created on ReportConfiguration.ui.
Display a button to toggle edit mode. Call LxCustomReportLib.hideEditToggle to hide it again. ReportConfiguration.allowEditing and ReportConfiguration.toggleEditingCallback need to be set to enable edit mode.
Display a custom legend for a given number of items. If a legend from a view is currently displayed, the calls to this function are ignored.
Legend items to be displayed
lx.showLegend([
{ label: 'foo', bgColor: '#ff0000' },
{ label: 'bar', bgColor: '#0000ff' }
])
Show a spinner on top of the report. Call LxCustomReportLib.hideSpinner to hide it again.
Show toastr of different types, with a custom message and a optional title.
toastr type
message content
Optional title: stringoptional title
lx.showToastr('error', 'Something went wrong');
lx.showToastr('warning', 'This is a warning', 'Attention');
Track report framework events with amplitude tracking.
event type and content
lx.trackReportEvent(
{
type: 'DataChange'
reportType: 'net.leanix.matrix'
baseFactSheetType: 'Application'
view: 'lifecycle'
cluster: ['relApplicationToBusinessCapability']
drilldown: ['relToChild']
}
);
Returns the translation of a custom translation key according to the user's current language. If the translation key can be resolved to a translated string interpolation will be applied. If the translation key resolves to an object the object will be returned.
Translation key
Optional interpolationData: Record<string, string | number>Interpolation data
Translation string or object
// For the custom translation json
{
"header": {
"title": "The title",
"subtitle": "Subtitle",
"description": "Hello {{name}}"
}
}
lx.translateCustomKey('header.title') // => 'The title'
lx.translateCustomKey('header') // => { "title": "The title", "subtitle": "Subtitle", "description": "Hello {{name}}" }
lx.translateCustomKey('header.description', { name: 'John' }) // => 'Hello John'
Returns the translation of a Fact Sheet type in singular or plural form. If multiplicity is not provided the singular version will be returned.
Fact Sheet type
Optional grammaticalNumber: "singular" | "plural"Grammatical number, i.e., 'singular' or 'plural'. Defaults to 'singular'.
Translation
lx.translateFactSheetType('BusinessCapability') // => 'Business Capability'
lx.translateFactSheetType('BusinessCapability', 'plural') // => 'Business Capabilities'
Returns the translation of a field on a Fact Sheet. In case the field is not present in the translation model, the fieldName would be returned.
Fact Sheet type
Name of the Fact Sheet field
Translation
lx.translateField('Application', 'release') // => 'Release'
Returns the translation of a field value for fields with predefined set of values (e.g. Single Select). In case the field value is not present in the translation model, the value would be returned.
Fact Sheet type
Name of the Fact Sheet field
Value of this field
Translation
lx.translateFieldValue('Application', 'functionalSuitability', 'appropriate') // => 'Appropriate'
Returns the translation of the items a Fact Sheet relation links to. In case the relation is not present in the translation model, the relationName would be returned.
Name of the relation
Translation
lx.translateRelation('relDataObjectToApplication') // => 'Applications'
lx.translateRelation('relToChild') // => 'Children'
Returns the translation of a field present in a relation. In case the relation is not present in the translation model, the fieldName would be returned.
Name of the relation
Field of the relation
Translation
lx.translateRelationField('relDataObjectToApplication', 'usage') // => 'Usage'
lx.translateRelationField('relApplicationToBusinessCapability', 'functionalSuitability') // => 'Functional Fit'
Returns the translation of a field value for fields with predefined set of values (e.g. Single Select) present in a relation. In case the relation, fieldName or fieldValue is not present in the translation model, the fieldValue would be returned.
Name of the relation
Field of the relation
Value of this field
Translation
lx.translateRelationFieldValue('relApplicationToBusinessCapability', 'functionalSuitability', 'appropriate') // => 'Appropriate'
In case the report has new requirements towards the report framework it can update the configuration that was initially passed to LxCustomReportLib.ready.
Side effect: calling this method de-registers all currently active message
listeners before registering the new ones derived from configuration. Any callbacks
(facet callbacks, UI callbacks, etc.) defined in the previous configuration will no
longer fire after this call. Ensure the new configuration is complete.
Use this method when report requirements change dynamically at runtime (e.g. switching the active fact sheet type, adding or removing facets). For the initial setup use LxCustomReportLib.ready instead.
New report configuration replacing the previous one
A static tableConfig should be returned via ReportConfiguration.tableConfigCallback, but if the tableConfig is dynamic, this function can be used to update it at any time.
Hint: if the provided attribute is a string field name, which is not present in the data model, this field would be ignored, and not shown as a table column.
Generated using TypeDoc
Entry class of the LeanIX Reporting Library. An instance of this class is globally available as
lxvariable.All methods in this library require LxCustomReportLib.init to be called first and its promise to be resolved before they can be used. Always initialize the library before calling other methods.
Example
See
Full API reference (TypeDoc)