Gareth Cantrell Posted March 15 Share Posted March 15 When configuring an asset import, given the following data structure, how can I go about accessing the list by index? For example, I would like to get the "Value" attribute from the record with FieldId 3. Would the following work: {{.Object.FieldDataItems[2].Value}} ? { "Object": { "Status": 0, "FieldDataItems": [ { "FieldId": 1, "ObjectId": 3, "Value": "KSDFSERWRE", "ValueAsBit": null, "ValueAsDate": null, "ValueAsFloat": null, "ValueAsInt": null, "ValueAsString": "KSDFSERWRE" }, { "FieldId": 2, "ObjectId": 3, "Value": "2023-09-27T00:00:00", "ValueAsBit": null, "ValueAsDate": "2023-09-27T00:00:00+01:00", "ValueAsFloat": null, "ValueAsInt": null, "ValueAsString": null }, { "FieldId": 3, "ObjectId": 3, "Value": "KLSDLSAD", "ValueAsBit": null, "ValueAsDate": null, "ValueAsFloat": null, "ValueAsInt": null, "ValueAsString": "KLSDLSAD" } ] } } Link to comment Share on other sites More sharing options...
SamS Posted March 15 Share Posted March 15 Hi @Gareth Cantrell, Which of the 14 (as of this writing) possible asset data sources our utility supports ( https://docs.hornbill.com/data-imports-guide/assets/configuration ) is this data coming from? Link to comment Share on other sites More sharing options...
Gareth Cantrell Posted March 18 Author Share Posted March 18 Hi @SamS These are custom fields in Certero which we use to track things like building, stock room and floor number. They are retrieved with the following OData query snippet: ..., Object($expand=FieldDataItems), ... Link to comment Share on other sites More sharing options...
SamS Posted March 19 Share Posted March 19 @Gareth Cantrell Under which parent object is "FieldDataItems" (or "Object" displaying)? "ComputerSystemInventory"? Other? Could you please respond with a FULL sample payload (obviously obscure the necessary data), and not just the branch of interest in this. Link to comment Share on other sites More sharing options...
Gareth Cantrell Posted March 19 Author Share Posted March 19 @SamS The Hornbill Certero integration is rooted at ComputerSystem. Object is a NavigationProperty of ComputerSystem, similar to ComputerSystemInventory. The full OData API call to Certero is: ComputerSystem?$expand=ComputerSystemInventory( $expand=OperatingSystem,ADUser($select=AccountName) ), ComputerSystemProcessorInfo, Object( $select=LocationId,Status;$expand=FieldDataItems ), WindowsSystemBio And the result (with values removed) is: { "@odata.context": "https://xxx.certero.com/api/odata/$metadata#ComputerSystem(ComputerSystemInventory(OperatingSystem(*),ADUser(AccountName)),ComputerSystemProcessorInfo(*),Object(LocationId,Status,FieldDataItems(*)),WindowsSystemBio(*))", "value": [ { "ComputerSystemObjectId": "", "ClientProducts": "", "ClientType": "", "ClientTypes": "", "ComputerSystemConfigurationId": "", "Modules": "", "NodeObjectId": "", "OperatingSystem": "", "ComputerSystemInventory": { "ComputerSystemObjectId": "", "ADUserObjectId": "", "ComputerDomain": "", "ComputerName": "", "EndpointServerObjectId": "", "IpAddress": "", "LastUpdate": "", "MacAddress": "", "Manufacturer": "", "Model": "", "NetworkObjectId": "", "OperatingSystemId": "", "SubnetMask": "", "Username": "", "Version": "", "Virtual": false, "OperatingSystem": { "OperatingSystemId": "", "BuildNumber": "", "Caption": "", "Family": "", "MajorVersion": "", "MinorVersion": "", "ProcessorArchitecture": "", "ProductType": "", "ReturnedProductType": "", "ServicePackMajor": null, "ServicePackMinor": null, "SuiteMask": "", "SystemMetrics": "", "VersionString": "" }, "ADUser": { "AccountName": "" } }, "ComputerSystemProcessorInfo": { "ComputerSystemObjectId": "", "CacheSizeK": "", "ClockSpeed": "", "Cores": "", "CoresPerCpu": "", "HTCapable": true, "HTEnabled": true, "LMExt": true, "LogicalCpus": "", "Manufacturer": "", "Model": "", "PhysicalCpus": "", "VMXExt": true }, "Object": { "Status": "", "FieldDataItems": [ { "FieldId": "1", "ObjectId": "", "Value": "", "ValueAsBit": null, "ValueAsDate": null, "ValueAsFloat": null, "ValueAsInt": null, "ValueAsString": "", }, { "FieldId": "2", "ObjectId": "", "Value": "", "ValueAsBit": null, "ValueAsDate": "", "ValueAsFloat": null, "ValueAsInt": null, "ValueAsString": null, }, { "FieldId": "3", "ObjectId": "", "Value": "", "ValueAsBit": null, "ValueAsDate": null, "ValueAsFloat": null, "ValueAsInt": null, "ValueAsString": "", }, { "FieldId": "4", "ObjectId": "", "Value": "", "ValueAsBit": null, "ValueAsDate": null, "ValueAsFloat": null, "ValueAsInt": null, "ValueAsString": "", }, { "FieldId": "5", "ObjectId": "", "Value": "", "ValueAsBit": null, "ValueAsDate": null, "ValueAsFloat": null, "ValueAsInt": null, "ValueAsString": "", }, { "FieldId": "6", "ObjectId": "", "Value": "", "ValueAsBit": null, "ValueAsDate": null, "ValueAsFloat": null, "ValueAsInt": "", "ValueAsString": null, } ] }, "WindowsSystemBio": { "WindowsSystemObjectId": "", "BiosMode": "", "Manufacturer": "", "Name": "", "ProductName": "", "ReleaseDate": "", "SMBIOSBIOSVersion": "", "SMBIOSUUID": "", "SecureBootEnabled": false, "SerialNumber": "" } } ] } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now