Skip to main content

Related Lists (Backreferences)

ServiceNow has the concept of Related Lists.

This is a very powerful and generic approach to retrieving relations to one specific entity for the purpose of rendering the relations of this one entity to others in a UI. The downside of this approach is that it can be resource intensive and slow. ServiceNow therefore gives developers the opportunity to defer retrieval of related lists even if this only applies to a single entity.

squid by arc46 tries to be as efficient and performant as possible. We therefore only support a subset of the functionality offered by ServiceNow with related lists, with what we like to call 'Backreferences', i.e. when the referenced entity has a reference pointing to the 'parent' entity.

Example: cmdb_ci_network_adapter has a property cmdb_ci, which is a reference to an entity cmdb_ci that contains the network adapter. If we want to render all cmdb_ci_network_adapter that belong to one or more cmdb_ci, we only have to query the table cmdb_ci_network_adapter and filter for the relevant sys_ids in the property cmdb_ci.

'Backreferences' can be resolved and retrieved with a single database query even for thousands of entities.

squid by arc46 will (probably) never support the more complex related lists.

Property Descriptions

Group

The name of the requested relation configuration group. This is set on the request as https://your_instance/api/TODO/v1/data/configName?relations=relationGroupName1,relationGroupName2.

All relation configurations belonging to the requested group are resolved and rendered.

Name

The name of the requested relations configuration. This is set on the request as https://your_instance/api/TODO/v1/data/configName?relations=relationName1,relationName2.

All requested relations are resolved and rendered.

JSON Property

todo

JSON Property Column

todo

example: cmdb_ci_network_adapter.name may have values such as 'eth0', 'wlan' etc. depending on your usecase you could render the network adapters as

{
"eth0": [
{
}
],
"wlan": [
{
}
]
}

instead of

{
"network_ports": [
{
"name": "eth0"
},
{
"name": "wlan"
}
]
}

Table Name

todo

Field Name

todo

Query

todo

Render

todo

TargetConfig

todo

subnets

subnets_ip_pool

PropertyValueComments
Group-
JSON Propertysubnets
Table Namecmdb_ci_ip_pool
Field Nameparent_pool
Query
RenderRelation Reference
Target Configcmdb_ci_ip_pool_minimal
Example JSON
{
...,
"data": [
{
"cidr": "10.192.0.0/13",
"name": "10.192.0.0/13",
"sys_class_name": "cmdb_ci_ip_pool",
"sys_id": "00c3324e87cd06506dc863540cbb359f"
}
],
"relations": {
"00c3324e87cd06506dc863540cbb359f": {
"subnets": [
{
"sys_id": "001933c287cd82503efcec230cbb35a8",
"sys_class_name": "cmdb_ci_ip_pool"
},
{
"sys_id": "001933c287cd82503efcec230cbb35ab",
"sys_class_name": "cmdb_ci_ip_pool"
},
...
],
...
},
"referenced": {
"001933c287cd82503efcec230cbb35a8": {
"cidr": "10.192.16.0/30",
"name": "10.192.16.0/30",
"parent_pool": {
"sys_id": "00c3324e87cd06506dc863540cbb359f",
"sys_class_name": "cmdb_ci_ip_pool"
},
"sys_class_name": "cmdb_ci_ip_network_subnet",
"sys_id": "001933c287cd82503efcec230cbb35a8"
},
"001933c287cd82503efcec230cbb35ab": {
"cidr": "10.196.252.0/30",
"name": "10.196.252.0/30",
"parent_pool": {
"sys_id": "00c3324e87cd06506dc863540cbb359f",
"sys_class_name": "cmdb_ci_ip_pool"
},
"sys_class_name": "cmdb_ci_ip_network_subnet",
"sys_id": "001933c287cd82503efcec230cbb35ab"
},
...
}
}

subnets_ip_pool_inline

PropertyValueComments
Group-
JSON Propertysubnets
Table Namecmdb_ci_ip_pool
Field Nameparent_pool
Query
RenderInline Content
Target Configcmdb_ci_ip_pool_minimal
Example JSON

subnets_ip_pool_only

PropertyValueComments
Group-
JSON Propertysubnets
Table Namecmdb_ci_ip_pool
Field Nameparent_pool
Querysys_class_name=cmdb_ci_ip_pool
RenderRelation Reference
Target Configcmdb_ci_ip_pool_minimal
Example JSON

subnets_ip_pool_only_inline

PropertyValueComments
Group-
JSON Propertysubnets
Table Namecmdb_ci_ip_pool
Field Nameparent_pool
Querysys_class_name=cmdb_ci_ip_pool
RenderInline Content
Target Configcmdb_ci_ip_pool_minimal
Example JSON
We track. Ok?