Is it possible to access the Asset field
Is it possible to access the asset field in a custom rule
I cant find the field listed anywhere.
Answers (3)
Yes, the asset tables are accessible. I recommend using a tool like MySQL Workbench and connecting to the database to view the tables.
ASSET - this is the main table for assets and includes the asset names and data common to all asset types.
ASSET_DATA_x - where x is the asset type ID for each type of asset. Most of the data about an asset is stored here. The column names are generated dynamically and will be in the form FIELD_y where y is the ID of the field.
ASSET_FIELD_DEFINITION - contains the field definitions for the assets, handy to use as a reference to figure out the column names in the ASSET_DATA_x tables.
Asset relationships represent non-hierarchical relationships between assets due to replacements, upgrades, or other circumstances. Relationships appear in the Primary Assets and Related Assets related lists on asset records.
Comments:
-
Thanks. That link between a HD ticket and the asset only works if the data is entered into the one and only asset field. We have other fields (e.g. Vehicle Asset) which provides a selection list based on that asset type. However when you go to the vehicle record there is no related HD ticket. If I enter the vehicle record into the Asset field that comes with Service Desk it creates that link. The reason we are using a unique asset field for Vehicles is that we want it only to list the vehicles (not the 25000+ assets). There is no way to build a rule to select only the vehicle asset type in the Asset record (If there was I would use the default Asset field) - kiwiblue 4 years ago
-
Are you using the asset field for another purpose for those tickets? If not, then you could create a rule that sets the asset field to the asset selected in your vehicle field. - chucksteel 4 years ago
-
Thanks Chucksteel. I have managed to do that but the Fleet number field (which is using the Vehicle asset name) when I use a rule to put it into the Asset field it seems to try and look for the unique asset id. E.g. if the Fleet number is 157 but the unique asset id for that record is 25045. When I get the custom rule to put the value (157) into the Asset field it seems to go and find the asset with a unique Asset id of 157. - kiwiblue 4 years ago
-
Your rule needs to be something like this:
UPDATE HD_TICKET
SET ASSET_ID = (SELECT ID FROM ASSET WHERE NAME = HD_TICKET.CUSTOM_FIELD_VALUEx and ASSET_TYPE_ID = y)
WHERE ID in (<TICKET_IDS>)
The x in CUSTOM_FIELD_VALUEx needs to match the value of the custom field column in the database, these are zero indexed, so custom field 1 is CUSTOM_FIELD_VALUE0.
The y in ASSET_TYPE_ID = y is the ID of the asset type for your vehicle assets. - chucksteel 4 years ago