Technical
Components
- Web Components
- Custom Endpoints
Table and Field Definitions Lime CRM
The Kpi table needs to be added to the solution. This can be done using the provided LIP-package.
If LIP can't be used, the structure needed is listed here. The table is only used for data storage by the
add-on and can be hidden from users by not adding views and setting it to only be visible to administrators in LISA.
KPI Table
Table name |
Local Field Name |
Database Field Name |
Field Type |
Length |
Description |
kpi |
owner_id |
owner_id |
Integer |
N/A |
|
kpi |
start_date |
start_date |
Time |
N/A |
|
kpi |
end_date |
end_date |
Time |
N/A |
|
kpi |
target |
target |
Decimal |
N/A |
|
kpi |
target_name |
target_name |
Text |
64 |
|
Custom Endpoints
There are a couple of endpoints which can be used to create your own front end presentation of data.
The base-URL is /limepkg-kpi
Target
GET /limepkg-kpi/target/
Returns all enabled targets for a specific limetype if provided. If not provided it returns all enabled targets.
Request Parameters
parameter |
type |
required |
example |
Description |
limetype |
String |
False |
company |
The limetype you want to fetch enabled targets for |
Response Example
{
"targets": [
{
"basic_settings": {
"name": "Customer Visits",
"enabled": true
},
"display_name": [
{
"lang": "en",
"text": "Customer visit"
},
{
"lang": "default",
"text": "Customer visit"
}
],
"kpi": {
"limetype": "history",
"date_property": "date",
"limetype_property": "type",
"option_keys": "customervisit",
"operation": "COUNT"
},
"time_period": {
"start_month": "January",
"end_month": "December",
"period_type": "Month"
},
"owner": {
"owner_limetype": "coworker"
},
"presentation": {
"divider": 1
}
}
]
}
KPI
GET /kpi/
Request Parameters
parameter |
type |
required |
example |
Description |
start_date |
Date |
True |
2020-05-01 |
Self explanatory |
end_date |
Date |
True |
2020-05-31 |
Self explanatory |
target_name |
String |
True |
dealvalue_per_month |
The name of the configured target which KPIs you want to fetch |
filter_id |
String |
False |
webclient.coworker.activecoworkers |
The ID of the webclient filter you want to use as a selection, returns for all if not provided |
Response Variables
variable |
type |
example |
Description |
owner |
Object |
- |
Contains information about the owner |
owner_limetype |
String |
company |
|
owners_kpis |
Object |
- |
Key => Id of owner id, Value => Kpi information |
descriptive |
String |
Kalle Kula |
Descriptive of the owner limeobject |
kpis |
Array |
- |
Contains the kpis for that owner |
start_date |
Date |
2020-01-01 |
|
end_date |
Date |
2020-01-31 |
|
limetype |
String |
history |
|
target |
Float |
20.0 |
|
expected_current_value |
Float |
15.0 |
|
current_value |
Float |
8.0 |
|
Example Response
{
"owner": {
"owner_limetype": "company",
},
"owners_kpis": {
"1001": {
"descriptive": "Tommy Lindh",
"kpis": [
{
"start_date": "2020-01-01",
"end_date": "2020-01-31",
"limetype": "history",
"target": 20,
"expected_current_value": 15,
"current_value": 8
},
{
"start_date": "2020-02-01",
"end_date": "2020-02-28",
"limetype": "history",
"target": 30,
"expected_current_value": 20,
"current_value": 22
}
]
},
"1002": {
"descriptive": "Björn Östberg",
"kpis": [
{
"start_date": "2020-01-01",
"end_date": "2020-01-31",
"limetype": "history",
"target": 20,
"expected_current_value": 15,
"current_value": 8
},
{
"start_date": "2020-02-01",
"end_date": "2020-02-28",
"limetype": "history",
"target": 30,
"expected_current_value": 20,
"current_value": 22
}
]
}
}
}
POST /kpi/
Used for creating new kpi limeobjects in lime
Request Body
parameter |
type |
required |
example |
Description |
owner_id |
Integer |
True |
2020-05-01 |
|
target_name |
String |
True |
2020-05-31 |
|
kpi_list |
Array |
True |
See example |
An array of information needed to create a KPI related to an unique KPI. |
start_date |
Date |
True |
2020-05-01 |
Self explanatory |
end_date |
Date |
True |
2020-05-31 |
Self explanatory |
target |
Float |
True |
5 |
The target you want to set for this KPI |
Example Request Body
{
"owner_id": 1,
"target_name": "my_target",
"kpi_list": [
{
"start_date": "2020-04-01",
"end_date": "2020-04-30",
"target": 5
},
{
"start_date": "2020-05-01",
"end_date": "2020-05-31",
"target": 3
}
]
}
PUT /kpi/
Used for updating existing kpi limeobjects in lime
Request Body
parameter |
type |
required |
example |
Description |
kpi_list |
Array |
True |
See example |
An array of information needed to update a KPI. |
id |
Date |
True |
2020-05-01 |
ID of the KPI you want to update |
target |
Float |
True |
2020-05-31 |
The new target you want to set on a KPI |
Example Request Body
{
"kpi_list": [
{
"id": 1001,
"target": 4500
}
]
}
GET /kpi-aggregated/
Aggregates targets and current value and expected current value for each time period depending on the targets time period.
Request Parameters
parameter |
type |
required |
example |
Description |
start_date |
Date |
True |
2020-05-01 |
|
end_date |
Date |
True |
2020-05-31 |
|
target_name |
String |
True |
dealvalue_per_month |
The name of the configured target which KPIs you want to fetch |
owner_id |
Integer |
False |
1001 |
The ID of the owner of the KPI you want to fetch aggregated information for |
filter_id |
String |
False |
webclient.coworker.activecoworkers |
The ID of the webclient filter you want to use as a selection, returns for all if both this and owner_id is empty |
Response Variables
variable |
type |
example |
Description |
owner |
Object |
- |
Contains information about the owner |
owner_limetype |
String |
company |
|
kpis |
Array |
- |
|
start_date |
Date |
2020-01-01 |
|
end_date |
Date |
2020-01-31 |
|
limetype |
String |
history |
|
target |
Float |
20.0 |
|
expected_current_value |
Float |
15.0 |
|
current_value |
Float |
8.0 |
|
Example Response
{
"owner": {
"owner_limetype": "company"
},
"kpis": [
{
"start_date": "2020-04-01",
"end_date": "2020-04-30",
"limetype": "history",
"target": 90.0,
"expected_current_value": 0,
"current_value": 44
}
]
}