utils.leanix_client_module
Using this module, you can interact with LeanIX without thinking about the LeanIX API.
Only minimal configuration is required: An API token is already enough, the rest is auto-detected.
Key Features
- It auto-detects your LeanIX host name and workspace
- It auto-detects your data model, i.e. all fact sheet types and their relations, which is very useful especially if you are running a non-standard data model
- It can boost your script performance by preloading all fact sheets of all types (or only selected types) into memory on startup, so that your script can operate on local data without fetching any data from LeanIX during runtime.
Examples
# Load all Application fact sheets
> applications = Application.all()
# Get their displayNames
> [app["displayName"] for app in applications]
['ERP - Global', 'HR - Global Human Resources System', 'LeanIX', 'Legacy ERP']
# Get subscriptions for a specific role
> app["subscriptions"].get("System Owner", []) # returns [] if fact sheet has no subscriptions in this role
[{'email': 'john.doe@example.com', 'id': '028b98f1-36da...', 'type': 'RESPONSIBLE', 'comment': 'test'},
{'email': 'jane.doe@example.com', 'id': '36da028b-98f1...', 'type': 'RESPONSIBLE', 'comment': 'test2'}]
# Get fact sheet by name or ID
> user_group = UserGroup("Acme Holding SE")
> user_group = UserGroup("3263428a-5841-409e-a8e2-22c334b4da53")
# Follow relations of a fact sheet
> app1.businesscapabilities()
[Controlling, Finance, Logistics, Materials Management, Sales] # List of BusinessCapability fact sheets
# Get the displayName of all processes related to an application
> [p["displayName"] for p in Application("ERP - Global ECC").processes()]
['Quote-to-Cash', 'Order-to-Invoice']
# Follow long chains of relations
> user_group.applications()[0].itcomponents()[0].providers() ...
# Tag helpers, attribute helpers
> user_group["location"]["geoCountry"]
> if "Holding" in user_group["tags"]["Company"] ...
Data Model
Your LeanIX data model is automatically translated into a Python data model. You can find the Python data model in
the file utils/ws_[workspacename]/fact_sheet_types.py.
If you made any changes to your LeanIX data model, you can force a re-generation of your Python data model by deleting the Python data model file.
Event Handlers
Besides leanix_client, we have built a component that makes it easy to define own event handlers that can react to
Webhook events. Have a look at the following event handlers which we have built using our own component:
create_subscription_handler.CreateSubscriptionHandlerto automatically subscribe somebody when they create a new fact sheetfact_sheet_deletion_mail_handler.FactSheetDeletionMailHandlerto receive an e-mail notification when somebody archives a fact sheetsubscription_deletion_mail_handler.SubscriptionDeletionMailHandlerto receive an e-mail notification when somebody removes their subscription from a fact sheet
Quality Reminders
As a key pillar of active data quality management, you need to remind your users whenever their fact sheets
have quality gaps. The quality_issue_reminder.QualityIssueReminder does exactly that: It applies Quality Checkers
to all users' fact sheets and sends a pretty e-mail summary to those users who need to act.
Quality Reports
To understand your data quality in the first place, a quality reports helps to see which parts of the organization are
still struggling to keep their data quality at an appropriate level. A Quality Report applies all relevant
Quality Checkers to FactSheets and organization.Organizations, and aggregates their result in an output format.
Reference implementation: data_completeness_per_organization.DataCompletenessPerOrganization
Quality Checkers
A quality checker can be applied to a FactSheet or an organization.Organization to evaluate whether those elements
have quality gaps (and if so, which gaps they have).
application_quality_checker.ApplicationQualityCheckerorganization_quality_checker.OrganizationQualityCheckeruser_quality_checker.UserQualityChecker
Initial Sync
The Initial Synchronization allows to execute an automation for all fact sheets. Initial Synchronizations can be started in the web configuration menu for every automation that has the option supports_initial_sync = True.
The Initial Synchronization works as follows:
- It simulates an event for every fact sheet of the fs_type that the automation is configured for
- It executes the automation with the current configuration for every fact sheet
- It shows a live log stream, displaying the log output for every execution of the handler
The default event that is passed to the event handler is a FactSheetUpdated event. If your automation relies on specific data within the event, your handler can implement a method called initial_sync_event, which takes the fact sheet as parameter and can build and return any event you like. For examples, look at some automations that implement the method "initial_sync_event", such as the FactSheetDeletionMailHandler.
Open-Source Licenses
LeanIX Automation Platform depends on open-source software. The open-source license files and the corresponding software package names are listed here: https://download.aronis.de/licenses/
Managing the connection to LeanIX and running all API calls.
Initializes a connection to the workspace provided. You can maintain API tokens for different workspaces in
leanix_config_local.py, and use workspace_name (such as AcmeProduction) to identify the one you want to use.
In the automation module, the default_tag_sets are the standard events that the automation webhook listens to.
Standard:
default_tag_sets = [
["pathfinder", "FACT_SHEET_CREATED"],
["pathfinder", "FACT_SHEET_UPDATED"],
["pathfinder", "FACT_SHEET_ARCHIVED"],
["pathfinder", "FACT_SHEET_DELETED"],
["pathfinder", "SUBSCRIPTION_DELETED"],
["pathfinder", "SUBSCRIPTION_UPDATED"],
["pathfinder", "SUBSCRIPTION_CREATED"],
["pathfinder", "FACT_SHEET_FIELD_UPDATED"],
["pathfinder", "FACT_SHEET_TAG_ADDED"],
["pathfinder", "FACT_SHEET_TAG_REMOVED"],
["pathfinder", "FACT_SHEET_ACCESS_CONTROL_LIST_UPDATED"],
["pathfinder", "RELATION_CREATED"],
["pathfinder", "RELATION_UPDATED"],
["pathfinder", "RELATION_SWITCH"],
["pathfinder", "RELATION_ARCHIVED"],
["pathfinder", "RELATION_DELETED"],
["pathfinder", "DOCUMENT_CREATED"],
]
In edit_webhook_interactively, you can activate and deactivate event types interactively for each webhook.
As available tag sets, it shows the union of default_tag_sets and further_tag_sets.
Loads the language model for language language into LeanIXClient().language_model[language].
Doesn't need to be called explicitly if you just need the English model; just access
LeanIXClient().language_model and it will lazy-load the model.
Only used internally by FactSheet.field(), but can also be called explicitly if you want to load another
language than English.
If users are not yet cached or if refresh is forced by setting force_refresh:
Loads all available users from LeanIX API and stores them in self.users as list of User instances.
The following attributes are loaded: firstName, lastName, displayName, email, status, currentLogin.
Returns the workspace URL, which is used to generate the links in the automatic e-mails.
Auto-detects some workspace properties so that you don't need to configure them:
- user id (of the user who created the token)
- workspace id
Also, it checks if the name of the workspace matches the name in your configuration, just to be sure your API token was configured for the correct workspace.
Generic method for calling any LeanIX API method. Takes care of:
- retry on HTTP error
- reconnecting if the session token has expired
- following a GraphQL cursor when calling the allFactSheets function
- following paginated REST APIs
- recognizing different kinds of errors (business logic or technical) and printing meaningful debug info
path is the path of the API method, such as '/services/pathfinder/v1/graphql'.
method is the http method: GET / POST / PUT / DELETE
body is the request body, either as JSON string or as dict (which will be auto-converted to JSON).
params is a dict with additional API parameters, such as {"page": 1}. Transferred as part of the request.
Returns the ["data"] part of the JSON response.
Generic method to call GraphQL functions.
Turns the JSON query into a string and calls self.request() to the GraphQL endpoint with HTTP method POST.
Returns the unprocessed response of self.request().
(Re-)loads all available subscription roles into self.subscription_roles.
Result:
{
'Application Owner': {
'id': 'd1c61fa4-050e-4713-9283-02f9ce43dded',
'name': 'Application Owner',
'description': '',
'subscriptionType': 'RESPONSIBLE',
'restrictToFactSheetTypes': [],
'mandatoryForFactSheetTypes': []
},
'IT Manager': {
...
}
}
Loads the user details of the API Token's user into self.user_name_[first|last|display]..
Warning: This creates a subscription role in the workspace configuration. If you want to subscribe a user to a fact sheet, use FactSheet.add_subscription().
Returns the tag id for a specific tag name and tag group name.
Warning: This deletes a tag from the workspace configuration. If you want to delete a tag from a fact sheet, use FactSheet.delete_tags().
Warning: This deletes a tag from the workspace configuration. If you want to delete a tag from a fact sheet, use FactSheet.delete_tags().
Loads all available tag groups and their tags into self.tag_groups. Result looks like this:
{
'Application Type': {
'description': 'This tag group defines the application type.',
'id': '02c7b01f-8927-4264-8c9d-4d3fe6df9b11',
'mandatory': False,
'mandatoryForFactSheetTypes': [],
'mode': 'MULTIPLE',
'name': 'Application Type',
'restrictToFactSheetTypes': ['Application'],
'shortName': None,
'tagCount': 4,
'tags': [
{
'color': '#75ff5b',
'deletable': False,
'description': 'A client application.',
'factSheetCount': 3,
'id': '4b45ead0-99dc-40f6-ab25-0f366ec09228',
'name': 'Client',
'status': 'ACTIVE'
},
{
'color': '#5b6bff',
'deletable': False,
'description': 'Mobile Application',
'factSheetCount': 14,
'id': '13f7447c-c880-4278-ac1c-c7c3e319a1ae',
'name': 'Mobile',
'status': 'ACTIVE'
}
]
}
Returns all Webhooks subscriptions.
Note: If the Managing User of a Webhook is set to "Current User (private Webhook)", other users cannot see it.
Returns the Webhook subscription with the given ID.
Note: If the Managing User of a Webhook is set to "Current User (private Webhook)", other users cannot see it.
Returns the status of a webhook.
Note: If the Managing User of a Webhook is set to "Current User (private Webhook)", other users cannot see it.
Deprecated, use get_webhook_events(subscription_id) instead.
Advances a Pull Webhook's cursor after an event has been processed successfully.
Returns all Webhook deliveries for Webhook webhook_id. The response can be pretty large, so size=10 is best.
Example:
`LeanIXClient().get_webhook_logs(id, {"sort": "createdAt-asc", "size": 15, "page": 1}, {"page_limit": 1})`
Sometimes LeanIX breaks webhooks. This function fixes a broken webhook by deleting and recreating it. Only works for PUSH webhooks at the moment.
Creates a webhook using a webhook dict structure containing all parameters. Used internally to (re-)create
webhooks. To create webhooks using a more intuitive method, please refer to LeanIXClient.register_webhook().
If you edit a webhook manually in the LeanIX UI, it forgets all non-standard event types it was subscribed to.
This function re-adds all non-standard event types (provided by default_tag_sets) to subscription id, or,
in case id is omitted, fixes all webhooks that contain "LeanIX Automation Platform" in their identifier.
Registers a new Webhook.
name: Name of the new Webhook.
target: Target URL including protocol and port number.
user: HTTP user, in case the Webhook uses HTTP basic auth. Set to "None" to switch off HTTP auth.
pwd: HTTP password, in case the Webhook uses HTTP basic auth.
delivery_type: "PUSH" or "PULL"
visibility: "WORKSPACE" (default) or "PRIVATE"
Internally calls LeanIXClient.create_webhook(wh).
Updates a Webhook.
webhook is the dict structure containing the webhook data, since it needs to be passed during the update.
Adds a single new event type to the webhook with the given id.
Examples:
LeanIXClient().add_webhook_event_type(id, "SUBSCRIPTION_DELETED")
LeanIXClient().add_webhook_event_type(id, "SUBSCRIPTION_CREATED")
LeanIXClient().add_webhook_event_type(id, "FACT_SHEET_FIELD_UPDATED")
Shows an interactive console to easily edit webhooks and add more (unsupported) event types to them.
As available tag sets, it shows the union of default_tag_sets and further_tag_sets.
Best run from console.py or from test_factSheet.py.
Example:
LeanIXClient().edit_webhook_interactively()
Loads the LeanIX feature configuration for this workspace into LeanIXClient().features.
Returns the configuration of a specific feature for this workspace. See load_features() for full list.
Loads the workspace's data model into LeanIXClient().data_model. Doesn't need to be called explicitly; just access LeanIXClient().data_model and it will lazy-load the model.
Loads the workspace's view model into LeanIXClient().view_model. Doesn't need to be called explicitly; just access LeanIXClient().view_model and it will lazy-load the model.
Creates a metrics schema.
Example:
schema_data = {
"name": "AronisAutomation",
"description": "Automated Test.",
"attributes": [
{"name": "factSheetId", "type": "dimension"}, # Include this to connect the schema to a fact sheet when creating a diagram
{"name": "Description", "type": "metric"},
{"name": "Owning Org", "type": "metric"},
{"name": "App Manager", "type": "metric"},
{"name": "Lifecycle", "type": "metric"},
]
}
LeanIXClient().create_schema(schema=schema_data)
Loads a series of points for the given schema id.
The optional parameter options["begin"] and options["end"] specifies the time range to load.
Note that timestamp needs to be an int, localized to the Europe/London timezone.
Example:
day = datetime.datetime(2024, 1, 1)
timezone = pytz.timezone('Europe/London')
day_localized = timezone.localize(day)
timestamp = int(day_localized.timestamp())
LeanIXClient().get_metric_points(schema_id, {"begin": timestamp - 3600, "end": timestamp})
Gets one single metric point by schema id and timestamp. See get_metric_points for timestamp requirements.
Posts a metric point into the schema with the given id.
Example:
point = {
"timestamp": timestamp,
"factSheetId": "1234-5678-....",
"Description": randint(0, 100),
"Owning Org": randint(0, 100),
"App Manager": randint(0, 100),
"Lifecycle": randint(0, 100),
}
LeanIXClient().post_metric_point(schema_id, point)
Calls post_metric_point for every single point in the points list.
Deletes the metric point with the given timestamp from the schema with the given id.
See get_metric_points for timestamp requirements.
Deletes all metric points within a range.
Currently not supported properly by LeanIX - returns errors (2023-01-15).
Saves the workspace settings as file. This is required before modifying the workspace settings via API call, so
that you can restore the settings in case of an error.
The file is stored as utils/settings.ws_[workspace name].[timestamp].json.
WARNING - This can break your workspace configuration! Only handle this with care, and always keep a backup
of your workspace settings in get_workspace_settings handy, so that you can reset them using this method.
Creates a single metrics chart. Currently only used internally for the Data Quality Management report.
Creates all KPI charts for the Data Quality Management report. Only used internally at the moment.
Returns all technical users.
Default params:
params = {"sort": "userName-ASC", "size": 30, "page": 1}
Returns the changelog of the technical user with the given id, including the creation of the user and the expiration extensions.
Default params:
params = {"sort": "createdAt-DESC", "size": 100, "page": 1}
Try to derive who is "responsible" for the technical user with the given id. Usually, this is the user who created the technical user.
Creates a new user in LeanIX by creating an invitation (by default: silent invitation without e-mail).
This is required if you want to subscribe a user that has not been created in LeanIX yet.
role can be "ADMIN", "MEMBER" or "VIEWER".
To send out a real invitation, set silent=False.
Note: Silent invitation without sending emails is not possible if LeanIX IDP is used - only for SSO workspaces.
Creates a new contact in LeanIX.
If the API token is not an ACCOUNTADMIN token, this method cannot create the contact directly. Instead, it
will use a workaround: The new user is subscribed to a dummy fact sheet, then removed from the fact sheet, and
then the fact sheet is deleted again.
You can pass a dummy fact sheet to this method using dummy_fs. If no dummy_fs is passed, the method will
create one and archive it at the end.
user needs to be passed like this:
{
"email": "john.doe@example.com",
"firstName": "Firstname",
"lastName": "Lastname"
}
Creates a bookmark.
bookmark is a dict describing the bookmark:
bookmark = {
"name": "My Saved Search",
"description": "My description",
"predefined": False,
"defaultSharingPriority": None,
"type": "INVENTORY",
"sharing": "SHARED",
"permittedReadUserIds": [],
"permittedWriteUserIds": [],
"state": {
"filter": {
"facetFilter": [],
"sorting": [{"key": "displayName", "order": "asc"}]
},
"viewMode": "list",
"tableConfig": {
"columns": [
{
"factSheetType": "Default",
"key": "displayName",
"sort": "",
"editable": False,
"sortable": True,
"resizable": True,
"type": "STRING"
},
{
"factSheetType": "Default",
"key": "type",
"sort": "",
"required": True,
"editable": False,
"sortable": True,
"width": 150,
"type": "STRING"
}
]
}
},
"workingCopy": None
}
Loads a specific bookmark, either by id or by name.
If a name is provided, the first matching bookmark is returned.
Loads a specific diagram, either by id or by name.
If a name is provided, the first matching diagram is returned.
Runs the integration as specified by the ldif parameter. Check test_factSheet.py for an example.
Use wait=True to wait for the integration run to finish before returning, so that your automation knows when the next run can start without overloading the Integration API.
Use wait=False to run asynchronously.
Creates a relation between two fact sheets. Low-level function, only use if FactSheet function cannot be used.
Deletes the relation between two fact sheet types.
Low-level function, only use if FactSheet function cannot be used.
Returns all ToDos for the specified fact sheets. See documentation for FactSheet.todos() for parameter details.
Creates a To-Do.
This is a low-level function that should only be used if you don't have a FactSheet instance where you can call FactSheet().create_todo(...).
fs_id is the fact sheet that the To-Do will be attached to.
user_ids is a list of user ids.
category is either "ACTION_ITEM" for ToDos, or "ANSWER" for questions.
due_date is a string in format YYYY-mm-dd.
Alternatively, due_days is a number of days, so that due_date is calculated automatically.
Example:
title = "My To-Do Item"
description = "My Description"
category = "ACTION_ITEM"
user_ids = [LeanIXUser.find_by_email("john.doe@example.com")["id"]]
due_date = "2029-12-31"
app.create_todo(fs_id="12345...", title=title, description=description, category=category, user_ids=user_ids, due_date=due_date)
See create_todo, but checks if a to-do in status OPEN or IN_PROGRESS with the same unique fields already exists, and updates the variable fields accordingly.
ToDos matching in all unique_fields will be deleted before creating new ToDos.
ToDos matching in all unique_fields AND all variable fields will be left unchanged if recreate is False.
Note: delete_outdated_todos() in quality_check_handler.py always uses ["title"], no other fields, so for
consistency reasons this should be ["title"] here as well.
Deletes all ToDos with the given ids.
Example:
# Deletes all To-Dos of an application
app = Application("MyTest")
todos = app.todos()
LeanIXClient().delete_todos(ids=[item["id"] for item in todos])
Returns all fields that are not used in the current view config. Warning: Uses an unofficial API endpoint: /services/pathfinder/v1/models/metaModel
Downloads a resource to the local file system.
Example:
app = Application("My Test Application")
LeanIXClient().download_resource(app["documents"][0])
Creates and downloads a full snapshot.
filename can contain the following format strings:
{time} = date + time
{workspace} = workspace name
Downloads the questions and results for each survey run as an Excel file.
filename can contain the following format strings:
{survey} = survey id
{run} = run id
{time} = date + time
{workspace} = workspace name
Gets the permission object for a user, either by user_id or by mail address.
Example:
permission = LeanIXClient().get_permission(mail="john.doe@example.com")
Updates a user's permission object, e.g. for changing a user's role from "VIEWER" to "MEMBER".
Example:
permission = LeanIXClient().get_permission(mail="john.doe@example.com")
permission["role"] = "MEMBER"
LeanIXClient().update_permission(permission)
Find the catalog items in the catalog catalog (saas or ltls) matching to the query.
Convenience method that takes a LeanIX webhook event as parameter and returns a dict that indicates: -
- which relations have been created
- which relations have been removed (i.e. deleted or archived)
- which relations have been updated
- which fact sheets are affected by this event because their relations or fields have been changed.
This is especially useful for translating the difficult RelationSwitch event - which is hard to interpret - into actionable sub-activities (one "create" and one "delete" activity).
Returns the LeanIX Sync Log items for the Sync Log entry with the given id.
Creates a log entry in the LeanIX "Sync Logging" section.
status: "OK" / "WARNING" / "ERROR"
createdAt / finishedAt: will be auto-filled, no need to pass this value.
progress: "RUNNING" / "FINISHED" / "FAILED"
scope: "PARTIAL" / "FULL"
items example:
[
{
"status": "OK", # or "WARNING" or "ERROR"
"createdAt": will be auto-filled, no need to pass this value.
"action": "CREATE", # or "UPDATE", "DELETE", "NONE"
"sourceId": "My Source ID",
"sourceName": "My Source Name",
"sourceType": "My Source Type",
"targetId": "My Target ID",
"targetName": "My Target Name",
"targetType": "My Target Type",
"message": "This can be a long message."
}
]
Implicitly called by create_sync_log_entry() if the items parameter is specified.
Ingests a manifest file and creates the corresponding microservice fact sheet.
Ingests an SBOM file into the microservice fact sheet with the given fact sheet ID.
Returns a list of length geo locations that match the given search query.
Example:
LeanIXClient().get_geo_locations(query="Zürich", length=1)
Returns all transformations for the specified fact sheet ids, or all transformations if no fs_ids are specified.
Returns all meta model actions for the given action batch.
Creates a new meta model field. Parameters: fs_type: The fact sheet type, e.g. "Application" field_name: The name of the new field, usually in camelCase field_type: 'INTEGER', 'STRING', 'SINGLE_SELECT' or 'MULTI_SELECT' section: the ID of the section, as returned by Appliction.sections() (or other fact sheet types instead of Application) subsection: the ID of the subsection within the section above, as returned by Application.subsections(section=section) (or other fact sheet types instead of Application) index: The positional index of the new field within the subsection. Starts at 0. Cannot be larger than the length of Application.field_properties(section, subsection), which returns all current fields in the given subsection. size: 2 (XS), 3 (S), 4 (M), 6 (L), 10 (XL) or 12 (XXL). weight: a decimal for data quality completion weight, default is 1.0 read_only: True or False render_type: 'number', 'date', 'text', 'textarea'. For fields with type SINGLE_SELECT: 'status' icon: Only valid for SINGLE_SELECT fields. Example: {'color': '#000000', 'order': 'ASC', 'reverse': False, 'type': 'shield-alt'}. Type must be one of the following: star, question-circle, exclamation-square, exclamation-triangle, check-circle, badge-check, ban, do-not-enter, arrow-up, arrow-down, bell, eye, lock-alt, shield-alt, bug, gavel, hammer, toolbox, globe, atom, fire-alt, bolt, lemon, lightbulb, user-hard-hat, user, robot, chess-queen-alt, hat-wizard, unicorn, yen-sign, euro-sign, pound-sign, dollar-sign values: Only for SINGLE_SELECT and MULTI_SELECT fields. Example: ['level1', 'level2', 'level3', 'level4'] metadata: Instead of "icon" and "values", you can pass the metadata of an existing field, which supports more options, e.g. colors for individual values. translations: list of label translation items for the field itself. You need to pass translation items for each language you want to provide label translations for. Example item: [{ 'language': 'en', 'translation': { 'label': 'Recovery Time Objective', 'helpText': 'Help Text for RTO', 'textLabel': 'Recovery Time Objective', 'isLabelEmpty': False } }] value_translations: In case of SINGLE_SELECT and MULTI_SELECT fields, you also need to pass translations for the values. value_translations is a dict with every value as a key and a list of translation items as value: { "level1": [{ 'language': 'en', 'translation': { 'label': 'Low Criticality', 'helpText': 'Help Text for Low Criticality', 'textLabel': 'This is Low Criticality', 'isLabelEmpty': False }], "level2": [...] } Supported languages for translations - pass only the ones that you need: en, de, es, fr, pt, jp metadata example: { "values": { "administrativeService": { "bgColor": "#86d02f" }, "businessOperational": { "bgColor": "#fff300" }, "businessCritical": { "bgColor": "#fe8501" }, "missionCritical": { "bgColor": "#bf110d" } }, "icon": { "type": "arrow-up", "color": "#bf110d", "reverse": false, "order": "ASC" } }
Returns all translations and value translations for a field, so that they can be used for transporting or copying a field.
Creates the calculation specified by the calculation object.
Example structure for simple calculation object:
{
"name": "Draft Status longer than 30 days",
"type": "fact-sheet",
"affectedFactSheetType": "Application",
"affectedFieldKey": "draftLongerThan30Days",
"affectedFieldType": "SINGLE_SELECT",
"description": "Calculates if draftDate is more than 30 days in the past",
"status": "active",
"code": "export function main() {
const draftDate = data.draftDate;
if (!draftDate) {
return null;
}
const draftDateMs = new Date(draftDate).getTime();
const nowMs = new Date().getTime();
const diffInDays = Math.floor((nowMs - draftDateMs) / (1000 * 60 * 60 * 24));
if (diffInDays > 30) {
return "yes";
} else {
return "no";
}
}", "fields": [ { "type": "fact-sheet", "factSheetRelation": null, "factSheetRelationName": null, "factSheetRelationSide": null, "factSheetRelationCodeSide": null, "relation": null, "relationName": null, "relationSide": null, "triggerType": "change", "key": "draftDate" } ] }
Example structure for calculation object with iteration across related fact sheets:
{
"id": "a5505b8b-5419-4d9c-bd35-bd6c753bc465",
"name": "Aggregate Foreign Attribute by Max/Min",
"description": "",
"active": true,
"code": "export function main() {
let result = null;
for (const fs of data.relApplicationToProcess) {
const input = fs.factSheet.recoveryPointObjective;
if (input != null) {
if (result == null || input < result) { // for max instead of min, change "<" to ">"
result = input;
}
}
}
return result;
} ", "language": "JAVASCRIPT", "version": 3, "updatedAt": "2025-08-16T08:14:27.125894Z", "createdAt": "2025-08-14T13:07:13.907312Z", "capability": { "type": "CALCULATIONS" } }
Updates the calculation specified by the calculation object.
Careful: Deletes all calculations. interactive=True asks before deleting an calculation. To delete all calculations without asking, specify interactive=False.
Careful: Deletes all automations. interactive=True asks before deleting an automation. To delete all automations without asking, specify interactive=False.
Loads all managed code execution configurations in the workspace.
Loads the managed code execution configuration with the given ID.
Loads all log entries of the managed code execution configuration with the given ID.
Loads a single log entry of the managed code execution configuration log entry with the given ID.
Creates the managed code execution configuration specified by the automation object.
Updates the managed code execution configuration specified by the configuration object.
Deletes the managed code execution configuration with the given ID. Not available in LeanIX yet.
Careful: Deletes all managed code execution configurations. interactive=True asks before deleting a configuration. To delete all configurations without asking, specify interactive=False.