When we get new mobile devices for our company we record them as assets in our KACE SMA.
Now I can create a new asset from the KACE GO app by scanning the mobile devices IMEI from the barcode on the retail box and saving the data directly to the KACE appliance.
Now I can create a new asset from the KACE GO app by scanning the mobile devices IMEI from the barcode on the retail box and saving the data directly to the KACE appliance.
But you can't automatically name the new asset after the barcode value, so in my case the IMEI number.
For every new asset, we had to copy/paste the barcode value of the IMEI to the Name-field of the asset after creation and save it again.
Today I figured out how this can be automated.
A prerequisite: your desired asset type needs to have a barcode field exactly named "Name", whose value will be assigned as the asset name then.
You may have to add that barcode field in the Asset Type Configuration dialogue:
Then, like in "Automatically enable new Windows 10 builds in KACE K1000 SMA", we will create a ticket rule for this.
A prerequisite: your desired asset type needs to have a barcode field exactly named "Name", whose value will be assigned as the asset name then.
You may have to add that barcode field in the Asset Type Configuration dialogue:
Note: the following instructions are provided without any warranty, make backups, test carefully and use this at your own risk!
- Go to "Configuration" section of your Service Desk module and to the "Rules" then
Hint: you can create ticket rules like this even if you normally do not use the service desk module! - If you want, switch to the service desk queue where you want to create the rule in - but it does not really matter which one it is since this one does not change any tickets at all. In this example we stay in the default queue.
Now hit the "Choose action" button and select "New (SQL)" then. - Enter a name for the rule like "Update Asset Name from Barcode Name value".
Check the box "Enabled" since we plan to run this scheduled. But you might want to run the rule manually until you fully tested this one.
In the "Select SQL" section, write this:SELECT 1 AS 'HD_TICKET.ID' - Leave all the following options unchecked except "Run update query". In this box, enter this:
UPDATE ASSET ast
INNER JOIN ASSET_BARCODE_JT abJT ON ast.ID = abJT.ASSET_ID
INNER JOIN BARCODE bc ON bc.ID = abJT.BARCODE_ID
SET ast.NAME = bc.BARCODE_DATA
WHERE
bc.BARCODE_DATA <> ast.NAME AND
bc.BARCODE_DATA <> '' AND
bc.BARCODE_NAME = 'Name' - Now set your schedule in the last section below. "15 minutes" is the shortest interval to choose. I prefer this value for this scenario since I want to have my assets named correctly as soon as possible. This query should not cause much impact on your appliance database performance, but you should test this in your environment.
If you prefer to run this manually, leave the "Schedule" section and disable the rule. You can still run it by hitting the "Run Now" button on demand.Don't forget to save your work by hitting the "Save" button!
We're done! Carefully test this (make a backup!!), the "Last run log" section in the ticket rule editor shows you the last query results with a number of all the updated records and any other output of the database engine.
Since we are now working with this method to name the new assets we slightly changed the process of creating new assets from the KACE GO-App: we now giving the new assets a bogus name (like '123') since we are required to provide a name before we can save the asset to the database at all.
The ticket rule now renames the new asset(s) in 15 minutes at the latest!
The ticket rule now renames the new asset(s) in 15 minutes at the latest!
A small tear drop: the rename action from the ticket rule will NOT be recorded in the asset history.
If I can answer any questions about this just leave a comment below.
If I can answer any questions about this just leave a comment below.
UPDATE ASSET ast
INNER JOIN ASSET_BARCODE_JT abJT ON ast.ID = abJT.ASSET_ID
INNER JOIN BARCODE bc ON bc.ID = abJT.BARCODE_ID
SET bc.BARCODE_DATA = ast.NAME, bc.BARCODE_FORMAT = "QR", bc.BARCODE_NAME = "QR TAG"
WHERE
ast.NAME = "JCxxxxxx" AND
bc.BARCODE_DATA <> ast.NAME AND
ast.NAME <> '' - JCKACE 6 years ago
You have your assets named the way you want and now you want to set a barcode-field named "QR TAG" to the assets name?
Does the "QR TAG" barcode field already exist for every asset targeted? - chrpetri 6 years ago
You may try this one (always make a backup before you try):
UPDATE BARCODE bc
INNER JOIN ASSET_BARCODE_JT abJT ON abJT.BARCODE_ID = bc.ID
INNER JOIN ASSET ast ON ast.ID = abJT.ASSET_ID
SET bc.BARCODE_DATA = ast.NAME
WHERE
ast.NAME LIKE 'JC______' AND
bc.BARCODE_DATA <> ast.NAME AND
ast.NAME <> '' AND
bc.BARCODE_FORMAT = 'QR' AND
bc.BARCODE_NAME = 'QR TAG'
This should limit the update to barcode fields with linked assets whose name starts with "JC" followed by 6 characters (since you wrote "JCxxxxxx"). - chrpetri 6 years ago