Custom Fields

Custom fields and fieldsets are available in Snipe-IT versions 2.1.0-pre and later.

Custom fields allow you to track additional information about your assets that the default asset attributes don't cover.

Check out the short video tutorial below for a full walkthrough:

Think of custom fieldsets as collections of custom fields. You can have a custom fieldset with just one custom field in it, or multiple custom fields. The idea of fieldsets is to keep commonly used fields grouped together so you don't have to add fields one-by-one to asset models.

1934

Custom fieldsets are assigned at the asset model level. So, for example, if you track mobile phones as Assets, you could create custom fields for "IMEI", "SIM", "Phone Number", etc.

You would then add all of those mobile phone related fields to a new "Mobile Phones" custom fieldset, and assign it to one of your mobile phone asset models.

1464

❗️

WARNING

Encrypting a field makes it unsearchable and unable to be sorted on in the database.

1368

Mobile phones fieldset

When you're adding a field to a fieldset, you can select whether that field should be required, what order it should appear in, and then select the fieldset to add from the select box.

1996

Then, for any mobile phone assets you create that belong to that asset model, the custom fields attributes will automatically appear.

To break it down step by step:

  • Create the new custom fields you want in your custom fieldset.
  • Create the new custom fieldset, and add the custom fields you just created.
  • Go to Admin > Asset Models and edit an asset model, selecting the custom fieldset you just created.

You can create the fields first, or the fieldset first, but be sure to add the new fields to your fieldset, and then associate that fieldset to an asset model to see those new fields on your asset forms.

Once your asset models have custom fieldsets associated with them, your new values will appear on the asset view and edit pages, and in the main asset listing table. You will be able to search/sort on these fields (as well as show/hide them in the table view) the same as you can the other built-in fields.

Custom Field Validation

We have provided support for basic input validation on the custom fields you create. When creating the fields, you'll have the option of selecting the Format the text input for your new fields should be in when your admins add or edit assets. You have several pre-defined options:

FormatDescription
ANYNo input validation. Any text is acceptable.
ALPHAThe field under validation must be entirely alphabetic characters.
ALPHA-DASHThe field under validation may have alpha-numeric characters, as well as dashes and underscores.
NUMERICThe field under validation must be numeric.
ALPHA-NUMERICThe field under validation must be entirely alpha-numeric characters.
EMAILThe field under validation must be formatted as an e-mail address.
DATEThe field under validation must be a valid date according to the strtotime PHP function.
URLThe field under validation must be a valid URL.
IPThe field under validation must be an IP address.
IPV4The field under validation must be an IPv4 address.
IPV6The field under validation must be an IPv6 address.
MACThe field under validation must be a valid MAC address.
BOOLEANThe field under validation must be able to be cast as a boolean. Accepted input are true, false, 1, 0, "1", and "0".
CUSTOMThis field allows you to use a regex expression for validation. It should start with regex: - for example, to validate that a custom field value contains a valid IMEI (15 numeric digits), you would use regex:/^[0-9]{15}$/.

🚧

Note:

To import custom fields, please see the Importing notes.

Common Custom Fields Regexes

Multiple Mac addresses: regex:/^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}|([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}(,([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2})*/