View fields set as dependent
Petition Details
- Base URL: {host}/ASMSAPI/
- Uri: /api/v9/additionalsfields/dependents/resolve
- Type: POST
-
Required headings:
- content-type: application/json
- X-Authorization: Bearer {token}
URL Description
- {host}: It represents the domain of the environment in which the API is located.
- ASMSAPI/: Fixed API prefix.
- URI: Specific endpoint for the request.
⚐ EXAMPLE URL:
https://{host}/ASMSAPI/api/v9/additionalsfields/dependents/resolve
Description
This endpoint allows you to see which child fields are activated and with which filtered values are available when a user selects a value in a parent field.
Request Body Parameters
| Name | Data type | Obligatory | Description |
|---|---|---|---|
| sourceFieldId | Number | Yes | The ID of the parent field whose dependencies you want to resolve. |
| selectedValueId | Number | No | Numeric identifier of the value selected in the parent field. It has the highest priority when multiple selection parameters are sent. |
| selectedValueKey | Text | No | Key of the value selected in the parent field. It only applies to CatalogList type fields. It has second priority when multiple selection parameters are sent. |
| selectedValueDescription | Text | No | Name or description of the value selected in the parent field. It has the lowest priority when multiple selection parameters are sent. |
⚐ NOTE: At least one of the parameters
selectedValueId,selectedValueKeyorselectedValueDescriptionit is mandatory. When multiple parameters are sent simultaneously, the system applies the following order of priority: selectedValueId > selectedValueKey > selectedValueDescription.
Body of the petition
Resolve by selectedValueId:
{
"sourceFieldId": 543,
"selectedValueId": 494
}
Resolve by selectedValueKey (CatalogList type field):
{
"sourceFieldId": 545,
"selectedValueKey": "Sede Norte(SN-001)"
}
Resolver by selectedValueDescription:
{
"sourceFieldId": 543,
"selectedValueDescription": "Colombia"
}
Answer
Child field type List:
{
"content": [
{
"catalogKeyValue": null,
"editable": true,
"fieldId": 544,
"fieldName": "Ciudad",
"fieldType": "List",
"inheritValueList": false,
"isConfigured": true,
"mandatory": true,
"values": [
{
"id": 497,
"key": null,
"name": "Bogota",
"order": 0
},
{
"id": 498,
"key": null,
"name": "Medellin",
"order": 0
}
],
"visible": true
}
],
"totalItems": 1
}
ShortText child field with inheritValues:
{
"content": [
{
"catalogKeyValue": "Sede Norte(SN-001)",
"editable": true,
"fieldId": 546,
"fieldName": "Código Postal",
"fieldType": "ShortText",
"inheritValueList": true,
"isConfigured": true,
"mandatory": false,
"values": [],
"visible": true
}
],
"totalItems": 1
}
No dependencies configured for the sent value:
{
"content": [],
"totalItems": 0
}
Response Parameters
| Name | Data type | Description |
|---|---|---|
| totalItems | Number | Total number of child fields that react to the value selected in the parent field. Return 0 when there are no dependencies configured for that value. |
| content | List | List of child fields with their behavior and available values. |
| fieldId | Number | Identifier of the child field. |
| fieldName | Text | Name of the child field. |
| fieldType | Text | Data type of the child field. |
| visible | Boolean | Indicates whether the child field should be displayed when the dependency is triggered. |
| editable | Boolean | Indicates whether the child field is editable when the dependency is activated. |
| mandatory | Boolean | Indicates whether the child field is required when the dependency is activated. |
| isConfigured | Boolean | Indicates whether the dependency has the visible, editable, and mandatory properties fully defined. Its value is false when the dependency was configured from the Administrator console for CheckBox type fields. |
| inheritValueList | Boolean | Indicates whether the child field has key inheritance active. Its value is true when the child field is type ShortText with inheritValues configured. |
| catalogKeyValue | Text | Key inherited from the value selected in the parent field. It only comes with value when inheritValueList is true. In other cases, its value is null. |
| values | List | List of filtered values available for the child field. It comes empty when the child field is type ShortText with inheritance, when filteredValueIds are not configured, or when the parent field is type CheckBox. |
| values.id | Number | Identifier of the filtered value. |
| values.name | Text | Name of the filtered value. |
| values.key | Text | Key of the filtered value. It only comes with value for CatalogList type fields. For List type fields, its value is null. |
| values.order | Number | Order of display of the value on consoles. |
Error messages
| Code | HTTP status | Error Message |
|---|---|---|
| 400 | BadRequest | sourceFieldId is required |
| 400 | BadRequest | selectedValueId, selectedValueDescription or selectedValueKey is required |
| 400 | BadRequest | Value with description {valor} does not exist in source field |
| 401 | Unauthorized | Token not provided or expired. |