Learn how to set up a custom calculation using the inboundFactSheet
processor of the Integration API. The processor calculates risk scores from numeric fields and writes the calculated score and mapped risk tier to custom fact sheet fields.
Overview
You can use the Integration API to set up custom calculations for fact sheet fields. In this tutorial, you'll learn how to configure an inboundFactSheet
processor to perform calculations and update custom fact sheet fields. The configuration includes three processors that run sequentially to:
- Read values from two numeric fields and calculate the total risk score.
- Write the total calculated score to a custom fact sheet field.
- Map the total risk score to a user-friendly risk tier and write the tier to a custom fact sheet field.
Alternatively, you can set up calculations using trigger-based automations. In this method, a webhook triggers a calculation whenever a specific fact sheet field is updated. For tutorials on setting up trigger-based automations for calculations, please visit:
- Calculating Risk Scores and Updating a Fact Sheet Based on Survey Responses
- Assigning Tags to Fact Sheets Based on a Custom Calculated Field
Prerequisites
You need an admin role for your SAP LeanIX workspace.
This tutorial assumes you have a basic understanding of:
- LeanIX Data Interchange Format (LDIF) of the Integration API
- Inbound processors of the Integration API, including the
inboundFactSheet
processor - Fact sheets in SAP LeanIX
Step 1: Create Custom Fact Sheet Fields
The processor in this tutorial is configured for application fact sheets. In the meta model configuration, create custom fields on the application fact sheet for individual risk scores, total risk score, and risk tier. To learn more about fact sheet configuration and fields, refer to:
To create custom fields, follow these steps:
-
In the administration area, navigate to the Meta Model Configuration section.
-
Select the application fact sheet.
-
Create a subsection for risk assessment by clicking Add subsection. Alternatively, you can add custom fields to an existing subsection.
-
To create custom fields within a subsection, click Add field and configure each field in the right-side panel. For details, refer to the following table. You can generate labels and help texts using AI-supported translation.
-
Save the changes.
Key | Field Type | Displayed As | Values and Labels |
---|---|---|---|
InfrastructureRiskScore | Integer | Number | N/a |
ApplicationOperationalRiskScore | Integer | Number | N/a |
TotalRiskScore | Integer | Number | N/a |
RiskTier | Single Select | Status | - Green - Yellow - Orange - Red |
The following image shows how custom fields appear on the application fact sheet.
Step 2: Map Risk Scores to Risk Tiers
Map the total risk score to a user-friendly risk tier. Here's an example mapping:
Risk Score | Risk Tier |
---|---|
< 10 | Green |
10–16 | Yellow |
17–23 | Orange |
> 23 | Red |
Include these mappings in the processor configuration, as described in the following step.
{
"key": {
"expr": "RiskTier"
},
"values": [
{
"expr": "${ lx.factsheet.TotalRiskScore < 10 ? 'Green' : lx.factsheet.TotalRiskScore < 17 ? 'Yellow' : lx.factsheet.TotalRiskScore < 24 ? 'Orange' : lx.factsheet.TotalRiskScore > 23 ? 'Red' : null}"
}
]
}
Step 3: Configure a Connector
To configure and run a connector, follow these steps:
- Go to the Integration API section in the administration area.
- Click New Processor Configuration, fill in the required details, and then click Create.
- On the connector configuration page, enter processors in the left-side section. For details, see Processor Configuration.
- In the Input section on the right, enter the input data. For details, see Input Data.
- To start a test run, click Test run. If successful, proceed to the next step.
- To start a run, click Run.
- To save the connector, click Save in the lower-left corner.
Tip
You can configure the processor to run automatically every day, keeping your inventory data up to date. To learn how to configure daily runs, refer to Configuring Automated Nightly Runs for Integration API Processors.
Processor Steps
The connector includes three processors that perform these tasks:
- Read values from the
InfrastructureRiskScore
andApplicationOperationalRiskScore
numeric fields and store them in theTotalRiskScore
variable. - Write the calculated total risk score to the
TotalRiskScore
field. - Map the total risk score to a user-friendly risk tier and write it to the
RiskTier
field.
Tip
When specifying multiple processors in the configuration, use the
run
attribute to set the execution order. Numeration starts at 0, so the processor with"run": 0
runs first, the processor with"run": 1
runs second, and so on.
Processor Configuration
Example processor configuration:
{
"processors": [
{
"processorType": "inboundFactSheet",
"processorName": "1. Gather scores and store in variables",
"processorDescription": "Gather Scores and Store in Variables",
"type": "Application",
"identifier": {
"search": {
"scope": {
"ids": [],
"facetFilters": [
{
"keys": [
"Application"
],
"facetKey": "FactSheetTypes",
"operator": "OR"
}
]
}
}
},
"run": 0,
"enabled": true,
"variables": [
{
"key": "${lx.factsheet.id.concat('_TotalRiskScore')}",
"value": "${helper:toList(lx.factsheet.InfrastructureRiskScore,lx.factsheet.ApplicationOperationalRiskScore)}"
}
],
"read": {
"fields": [
"InfrastructureRiskScore",
"ApplicationOperationalRiskScore"
]
}
},
{
"processorType": "inboundFactSheet",
"processorName": "2. Write total risk score",
"processorDescription": "Gather Scores and Store in Variables",
"type": "Application",
"identifier": {
"search": {
"scope": {
"ids": [],
"facetFilters": [
{
"keys": [
"Application"
],
"facetKey": "FactSheetTypes",
"operator": "OR"
}
]
}
}
},
"run": 1,
"updates": [
{
"key": {
"expr": "TotalRiskScore"
},
"values": [
{
"expr": "${variables[lx.factsheet.id.concat('_TotalRiskScore')].getNumbers().sum() != 0 ? variables[lx.factsheet.id.concat('_TotalRiskScore')].getNumbers().sum() : null }"
}
]
}
],
"enabled": true
},
{
"processorType": "inboundFactSheet",
"processorName": "3. Write Risk Tier",
"processorDescription": "Assign Risk Tier based on Total Risk Score",
"type": "Application",
"identifier": {
"search": {
"scope": {
"ids": [],
"facetFilters": [
{
"keys": [
"Application"
],
"facetKey": "FactSheetTypes",
"operator": "OR"
}
]
}
}
},
"run": 2,
"updates": [
{
"key": {
"expr": "RiskTier"
},
"values": [
{
"expr": "${ lx.factsheet.TotalRiskScore < 10 ? 'Green' : lx.factsheet.TotalRiskScore < 17 ? 'Yellow' : lx.factsheet.TotalRiskScore < 24 ? 'Orange' : lx.factsheet.TotalRiskScore > 23 ? 'Red' : null}"
}
]
}
],
"enabled": true,
"read": {
"fields": [
"TotalRiskScore"
]
}
}
],
"variables": {}
}
Input Data
Example input data:
{
"connectorType": "DerivedScoring",
"connectorId": "DerivedScoring",
"connectorVersion": "1.0.0",
"lxVersion": "1.0.0",
"description": "",
"processingDirection": "inbound",
"processingMode": "partial",
"customFields": {},
"content": [
{
"type": "",
"id": "",
"data": {}
}
]
}
Summary
In this tutorial, you learned how to configure an inboundFactSheet
processor to perform calculations and update custom fact sheet fields.