La clase “core_company” es requerida por diferentes clases de ServiceNow, en el archivo de configuración donde es referenciada use la propiedad “mappingName” para designar como obtendrá sus valores acordes al campo que referencie a esta clase. Los atributos que se toman en cuenta son los siguientes:
- Name
- Manufacturer
- Vendor
Los atributos de la clase “core_company” mapeados al archivo de configuración toma esta forma:
{
"searchBy": [
"name"
],
"name": "core_company",
"fields": [
{
"type": "string",
"name": "name",
"mappingType": "Mapper",
"mappingName": null,
"isRequired": true,
"classReference": null
},
{
"type": "boolean",
"name": "manufacturer",
"mappingType": "Data",
"mappingName": null,
"isRequired": false,
"classReference": null
},
{
"type": "boolean",
"name": "vendor",
"mappingType": "Data",
"mappingName": null,
"isRequired": false,
"classReference": null
}
]
}
Es importante resaltar que esta clase tiene propiedades de “mappingType” = “Data”, este tipo de valor se registraran en la propiedad “dataReference” del archivo de configuración.
Escriba la clase en el archivo de configuración con la clase que la referencia, en esta clase “cmdb_ci_computer”
{
"dataReference": [
],
"mapper": [
],
"classCMDB": [
{
"searchBy": [
"object_id"
],
"name": "cmdb_ci_computer",
"fields": [
{
"type": "string",
"name": "manufacturer",
"mappingType": "Reference",
"mappingName": "CompanyManufactureReference",
"isRequired": false,
"classReference": "core_company"
},
{
"type": "string",
"name": "company",
"mappingType": "Reference",
"mappingName": "CompanyOwnerReference",
"isRequired": false,
"classReference": "core_company"
}
]
},
{
"searchBy": [
"name"
],
"name": "core_company",
"fields": [
{
"type": "string",
"name": "name",
"mappingType": "Mapper",
"mappingName": null,
"isRequired": true,
"classReference": null
},
{
"type": "boolean",
"name": "manufacturer",
"mappingType": "Data",
"mappingName": null,
"isRequired": false,
"classReference": null
},
{
"type": "boolean",
"name": "vendor",
"mappingType": "Data",
"mappingName": null,
"isRequired": false,
"classReference": null
}
]
}
]
}
La clase “core_company” es referenciada dos veces. Esto no implica duplicar la clase en la propiedad “classCMDB”, sólo se agrega una vez mediante la propiedad “mappingName” que se referencia a “dataReference” y “mapper” para obtener los valores de la siguiente forma:
- CompanyManufactureReference
- CompanyOwnerReference
{
"dataReference": [
],
"mapper": [
],
"classCMDB": [
{
"searchBy": [
"object_id"
],
"name": "cmdb_ci_computer",
"fields": [
{
"type": "string",
"name": "manufacturer",
"mappingType": "Reference",
"mappingName": "CompanyManufactureReference",
"isRequired": false,
"classReference": "core_company"
},
{
"type": "string",
"name": "company",
"mappingType": "Reference",
"mappingName": "CompanyOwnerReference",
"isRequired": false,
"classReference": "core_company"
}
]
}
]
}
Para resolver el valor del “mappingName”: “CompanyOwnerReference”, se creara de forma estática para todos los dispositivos relacionados con la clase “cmdb_ci_computer”; se registra el valor que tomará el atributo “fieldCMDB”: “name” de la clase “core_company” en “dataReference” de la siguiente forma:
{
"dataReference": [
{
"name": "CompanyOwnerReference",
"fields": [
{
"value": "Aranda Software",
"fieldCMDB": "name",
"classDevice": [
"Desktop",
]
},
{
"value": "false",
"fieldCMDB": "manufacturer",
"classDevice": [
"Desktop",
]
},
{
"value": "false",
"fieldCMDB": "vendor",
"classDevice": [
"Desktop",
]
}
]
}
],
"mapper": [
],
"classCMDB": [
]
}
Se agrega de esta forma porque las APIs de Aranda DEVIDCE MANAGEMENT ADM no traen la información de la compañía del propietario.
Uniendo todas las configuraciones:
{
"dataReference": [
{
"name": "CompanyManufactureReference",
"fields": [
{
"value": "false",
"fieldCMDB": "manufacturer",
"classDevice": [
"Desktop",
]
},
{
"value": "false",
"fieldCMDB": "vendor",
"classDevice": [
"Desktop",
]
}
]
},
{
"name": "CompanyOwnerReference",
"fields": [
{
"value": "Aranda Software",
"fieldCMDB": "name",
"classDevice": [
"Desktop",
]
},
{
"value": "false",
"fieldCMDB": "manufacturer",
"classDevice": [
"Desktop",
]
},
{
"value": "false",
"fieldCMDB": "vendor",
"classDevice": [
"Desktop",
]
}
]
}
],
"mapper": [
{
"name": "CompanyManufactureReference",
"fields": [
{
"fieldDevice": "manufacturer",
"fieldCMDB": "name"
}
]
},
],
"classCMDB": [
{
"searchBy": [
"object_id"
],
"name": "cmdb_ci_computer",
"fields": [
{
"type": "string",
"name": "manufacturer",
"mappingType": "Reference",
"mappingName": "CompanyManufactureReference",
"isRequired": false,
"classReference": "core_company"
},
{
"type": "string",
"name": "company",
"mappingType": "Reference",
"mappingName": "CompanyOwnerReference",
"isRequired": false,
"classReference": "core_company"
}
]
},
{
"searchBy": [
"name"
],
"name": "core_company",
"fields": [
{
"type": "string",
"name": "name",
"mappingType": "Mapper",
"mappingName": null,
"isRequired": true,
"classReference": null
},
{
"type": "boolean",
"name": "manufacturer",
"mappingType": "Data",
"mappingName": null,
"isRequired": false,
"classReference": null
},
{
"type": "boolean",
"name": "vendor",
"mappingType": "Data",
"mappingName": null,
"isRequired": false,
"classReference": null
}
]
}
]
}