Tina.Lapere Posted November 24, 2023 Share Posted November 24, 2023 Hi, I need to update all our assets to include the department field (currently not completed on every asset). My Colleague has been directed to read the following: Data Import Guides - Introduction (hornbill.com) as apparently this is the only way to update assets in bulk. Neither of us know anything about JSON files so are really struggling with this. Considering Hornbill say you don't need any technical skills to be able to use the product this is definitely beyond our knowledge and have never needed to know this before. Is there anyone who is able to help us with understanding how we go about this? Thanks Tina Link to comment Share on other sites More sharing options...
Jim Posted November 24, 2023 Share Posted November 24, 2023 Hi @Tina.Lapere, Could you advise what fields it is you intend to update and what the asset types are? Where will this data come from? a spreadsheet or directly from a database? For further information this may help also Asset Data Import Tool - Hornbill Link to comment Share on other sites More sharing options...
Tina.Lapere Posted November 24, 2023 Author Share Posted November 24, 2023 Hi @Jim, We need to populate the 'Department' field for the following types: Mobile Device, Computer Peripheral, Computer System and Printer. Our plan was to export them from Hornbill then update that and our hope was to be able to import this somehow. Thanks Tina Link to comment Share on other sites More sharing options...
Berto2002 Posted November 24, 2023 Share Posted November 24, 2023 i have sent you an example procedure which might be useful for you. @Tina.Lapere. 2 Link to comment Share on other sites More sharing options...
Blowerl Posted November 29, 2023 Share Posted November 29, 2023 Now getting the json file to run, but in the log file I get [DEBUG] Asset match not found, but OperationType not set to Both or Create, not sure what I am missing? (The final part of the JSON defines the match of the database column name with column name on the CSV) do you have to add all column names in the AssetGenericFieldMapping/AssetTypeFieldMapping"? Link to comment Share on other sites More sharing options...
Jim Posted November 29, 2023 Share Posted November 29, 2023 Could you provide the json file? Link to comment Share on other sites More sharing options...
Blowerl Posted November 30, 2023 Share Posted November 30, 2023 Here is a screenshot of the file Link to comment Share on other sites More sharing options...
Steve Giller Posted November 30, 2023 Share Posted November 30, 2023 @Blowerl What version of the Import Tool are you using, because that looks like the JSON for the older, deprecated version - so you may be using an old Import Tool that has bugs that are fixed in the current release, or you may be using the wrong JSON configuration the the tool. Link to comment Share on other sites More sharing options...
Blowerl Posted November 30, 2023 Share Posted November 30, 2023 I downloaded the import tool yesterday, 4.2.2 Link to comment Share on other sites More sharing options...
Steve Giller Posted November 30, 2023 Share Posted November 30, 2023 It doesn't appear that you've updated the JSON with the new format - the start of the file for this version is: { "LogSizeBytes": 1000000, "HornbillUserIDColumn": "h_user_id", "SourceConfig": { "Source": "csv", "CSV": { "CarriageReturnRemoval": false, "CommaCharacter": ",", "FieldsPerRecord": 0, "LazyQuotes": false } }, "AssetTypes": [{ but the image you posted still has the InstanceId and keySafeId showing. Link to comment Share on other sites More sharing options...
Blowerl Posted December 4, 2023 Share Posted December 4, 2023 I have changed the json file and now when I run it I get the messages below. Which don't mean too much to me. Any pointers. panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x0 pc=0x3fb3fe] goroutine 1 [running]: net/http.(*Transport).alternateRoundTripper(0x0, 0xa8be080) net/http/transport.go:507 +0x5e net/http.knownRoundTripperImpl({0x6be8f0, 0x0}, 0xa8be080) net/http/client.go:316 +0x43 net/http.setRequestCancel(0xa8be080, {0x6be8f0, 0x0}, {0xc15386919a0ea6b8, 0x17c6edc029, 0xa21c00}) net/http/client.go:348 +0xb6 net/http.send(0xa8be000, {0x6be8f0, 0x0}, {0xc15386919a0ea6b8, 0x17c6edc029, 0xa21c00}) net/http/client.go:250 +0x525 net/http.(*Client).send(0xa8bc020, 0xa8be000, {0xc15386919a0ea6b8, 0x17c6edc029, 0xa21c00}) net/http/client.go:176 +0x87 net/http.(*Client).do(0xa8bc020, 0xa8be000) net/http/client.go:716 +0x890 net/http.(*Client).Do(...) net/http/client.go:582 github.com/hornbill/goApiLib.(*XmlmcInstStruct).Invoke(0xa801c20, {0x5feaa4, 0x6}, {0x600d36, 0xa}) github.com/hornbill/goApiLib@v1.1.0/apiLib.go:328 +0x909 main.espLogger({0x61faa2, 0x34}, {0x5fe95a, 0x6}) github.com/hornbill/goDBAssetImport/main.common.go:262 +0x162 main.main() github.com/hornbill/goDBAssetImport/main.go:90 +0x81f Link to comment Share on other sites More sharing options...
Blowerl Posted December 5, 2023 Share Posted December 5, 2023 I am guessing the errors above was a problem at your end, as it now runs again. Still with the error [DEBUG] Asset match not found, but OperationType not set to Both or Create Link to comment Share on other sites More sharing options...
Jim Posted December 5, 2023 Share Posted December 5, 2023 In terms of the asset matching 1. Does the CSV contain the exact same information as held in the asset tag field within hornbill? 2. Is the asset class 100% Mobile? The error you are getting is basically saying it can not find an asset that matches what is in the csv, and it can not create it as you have chosen to only update existing assets. Hope this helps you to diagnose Link to comment Share on other sites More sharing options...
Blowerl Posted December 5, 2023 Share Posted December 5, 2023 I have exported all mobiles devices from hornbill and selected all fields. So trying to write a json for that csv file. The reason for update existing is I need to change some of the department names in all assets, but starting with mobile devices. Link to comment Share on other sites More sharing options...
Jim Posted December 5, 2023 Share Posted December 5, 2023 If you are exporting out of Hornbill and then importing back in, I would highly recommend using the asset ID instead h_asset_id Link to comment Share on other sites More sharing options...
Blowerl Posted December 5, 2023 Share Posted December 5, 2023 Sorry about all the questions. If you run a -dryrun=true If the log shows this: <params><application>com.hornbill.servicemanager</application><entity>Asset</entity><returnModifiedData>true</returnModifiedData><primaryEntityData><record><h_pk_asset_id>3020</h_pk_asset_id><h_asset_urn>urn:sys:entity:com.hornbill.servicemanager:Asset:3020</h_asset_urn><h_department>SLT</h_department></record></primaryEntityData></params> 2023/12/05 14:44:46 -=- Updated Assets -=- 2023/12/05 14:44:46 * Updated: 0 2023/12/05 14:44:46 * Skipped: 1 2023/12/05 14:44:46 * Failed: 0 Does this mean that it's worked? Link to comment Share on other sites More sharing options...
Jim Posted December 5, 2023 Share Posted December 5, 2023 Yes it has resolved 1 record, but skipped it due to being in dry run mode sounds like good progress Link to comment Share on other sites More sharing options...
Blowerl Posted December 6, 2023 Share Posted December 6, 2023 This is the field in the asset under General Properties, would it be called h_department General Properties Link to comment Share on other sites More sharing options...
Steve Giller Posted December 6, 2023 Share Posted December 6, 2023 Department is stored as two values - the Department ID and the Department Name. These use the fields h_department_id and h_department_name respectively. You will want to ensure that both fields are populated for each record, and that the correct ID for the Name is used in each case. Link to comment Share on other sites More sharing options...
Blowerl Posted December 7, 2023 Share Posted December 7, 2023 This is now my next error. Caching Application Records from Hornbill... [TEMPLATE] Parsing Error: template: {{.Department ID}}:1: function "ID" not defined [h_department_id] [TEMPLATE] Parsing Error: template: {{.Department Name}}:1: function "Name" not defined [h_department_name] [TEMPLATE] Parsing Error: template: {{.Department ID}}:1: function "ID" not defined [h_department_id] [TEMPLATE] Parsing Error: template: {{.Department Name}}:1: function "Name" not defined [h_department_name] [ERROR] [Template] Issues were found with the template. When creating the CSV file, you just select asset\mobile device\ and click on Export? Would this then hold the department Or do you have to change the CSV file. Link to comment Share on other sites More sharing options...
Jim Posted December 7, 2023 Share Posted December 7, 2023 As simple as it sounds I would remove any spacing in the column headers, and correct the json also try a format like department_Name and department_Id Link to comment Share on other sites More sharing options...
Blowerl Posted December 7, 2023 Share Posted December 7, 2023 Thanks Jim for you help on this matter. I now don't get no errors went running it. I have even run it a without the dryrun and it's says -=- Updated Assets -=- * Updated: 1 * Skipped: 0 * Failed: 0 * Extended Record Skipped: 1 * Extended Record Failed: 0 I have then checked the asset and nothing has changed. Link to comment Share on other sites More sharing options...
Blowerl Posted December 20, 2023 Share Posted December 20, 2023 Having a look at this webpage (Asset Attributes_, I don't seem to see department on it. Does that mean you can't change this field on Assets? https://wiki.hornbill.com/index.php?title=Understanding_the_Asset_Structure 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