Jump to content

Assets - Updating in Bulk


Tina.Lapere

Recommended Posts

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

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

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

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

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

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

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

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

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

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

  • 2 weeks later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...