Gareth Roberts Posted June 20, 2022 Share Posted June 20, 2022 I've been trying to use the Database Import tool, using a csv, but I am unable to import the State and Substate information into Asset Management. I have CSV and an json file that works as long as no attempt is made to sync information to the state field (h_record_state according to the conf_example_csv.json example file provided with the tool). If I include a mapping to a CSV field in in the h_record_state or h_operational_state fields, then the import fails with the error [ERROR] Unable to add asset: A database or query error occurred while inserting the primary record data into the database. (table=h_cmdb_assets, pk=XXX) [DEBUG] API Call XML: <params><application>com.hornbill.servicemanager</application><entity>Asset</entity><returnModifiedData>true</returnModifiedData><primaryEntityData><record><h_class>computer</h_class><h_type>2</h_type><h_last_updated>[a date]</h_last_updated><h_last_updated_by>Import - Add</h_last_updated_by><h_used_by>[user details]</h_used_by><h_used_by_name>[user details]</h_used_by_name><h_used_by_name>[user details]</h_used_by_name><h_name>[laptop info]</h_name><h_asset_tag>[]asset tag]</h_asset_tag><h_description>[laptop info]</h_description><h_record_state>Active</h_record_state></record></primaryEntityData><relatedEntityData><relationshipName>AssetClass</relationshipName><entityAction>insert</entityAction><record><h_type>2</h_type><h_dsc_cf_fingerprint>[fingerprint info]</h_dsc_cf_fingerprint><h_name>[laptop info]</h_name><h_model>[model info]</h_model><h_manufacturer>[laptop manufacturer]</h_manufacturer><h_description>[description info]</h_description><h_serial_number>[serial number]</h_serial_number></record></relatedEntityData></params> I have made sure that the values in the CSV match the State, and as it stands I cannot find the database field to sync for Substate - though these bit of information are key to making this import worth it. I don't fancy setting the state and substate on a few thousand assets I've attached a text file which is the JSON i've been using (with sensitive info removed). Help much appreciated! conf_laptops_csv.txt Link to comment Share on other sites More sharing options...
Victor Posted June 20, 2022 Share Posted June 20, 2022 @Gareth the "Active" value you have for h_record_state is not a valid value. You need an INT (number). Here are the possible values accepted for this field: More information about the Entity Explorer can be found here: https://wiki.hornbill.com/index.php?title=Application_Entity_Viewer 1 Link to comment Share on other sites More sharing options...
Gareth Roberts Posted June 20, 2022 Author Share Posted June 20, 2022 Yes, perfect, this has solved the issue I was having completely! Cheers! 1 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