This post will attempt to show how to auto-populate and update an asset field based on concatenating other asset fields. The fields/columns will need to change to match the tables and columns from your database. Use the Report Wizard to create a report for the specific Asset Type and select all fields. Then Edit SQL to get the actual field/column names for your environment.
Note: I use Monitor as an example here but this can be accomplished with any Asset Type.
1. Create Asset Type “Monitor"
2. Add Asset Fields Manufacturer, Type, Size, Description to “Monitor”
3. Create a Monitor Asset with Manufacturer = Dell, Type = LED, Size = 24
4. Go to Service Desk > Configuration > Rules
5. Create a new Rule “Asset Rule – Update Monitor Description”
6. Enter Select SQL:
SELECT ASSET.NAME AS ASSET_NAME
, ASSET_DATA_14.FIELD_10005 AS Manufacturer
, ASSET_DATA_14.FIELD_10006 AS Type
, ASSET_DATA_14.FIELD_10007 AS Size
, CONCAT(LEFT(ASSET_DATA_14.FIELD_10005,1), "-", ASSET_DATA_14.FIELD_10006, "-", ASSET_DATA_14.FIELD_10007) as Description
FROM ASSET_DATA_14
LEFT JOIN ASSET ON ASSET_DATA_14.ID = ASSET.ASSET_DATA_ID
AND ASSET.ASSET_TYPE_ID=14
ORDER BY ASSET_NAME
7. Enter Update SQL:
UPDATE ASSET_DATA_14
SET ASSET_DATA_14.FIELD_10008 = CONCAT(LEFT(ASSET_DATA_14.FIELD_10005,1), "-", ASSET_DATA_14.FIELD_10006, "-", ASSET_DATA_14.FIELD_10007)
8. Set Frequency to desired amount (15 minutes in my example) then Save
When changing some of the fields, after 15 minutes (or a manual rule run) the Description will update with the new info.
Comments