Custom Fields

From WHMCS Documentation

Revision as of 19:22, 17 May 2011 by Matt (talk | contribs)

Custom fields allow you to collect additional information from your clients. WHMCS allows you to setup an unlimited number of customer fields which apply to clients, individual products & services and/or support departments. They can be set as either public or admin only for private use.

Common examples are questions like how did you find out site, do you want to join the mailing list, VAT/Tax Number, etc...

Supported Field Types

  • Text Box - for text entry
  • Dropdown Menu - for a selection of options to choose from
  • Tick Box - for a yes/no answer
  • Textarea - for a long text entry of multiple lines

Types of Custom Fields

Client Custom Fields

You can create client profile related fields in Setup > Custom Client Fields. These can be set to Show on Order Form if you want the client to enter them or left as admin area only for private entries. The client can view and edit the field values from the client area unless they are set to admin only.

Product Custom Fields

Products you create can also have custom fields added to them which are then shown to the user during the order process. This allows you to collect further information specific to an individual product. These are set when configuring a product in Setup > Products & Services. Some modules require specific fields are setup and will be explained in the documentation for that module.

Support Custom Fields

Custom fields for support are set per department and allow you to ask users for additional information when opening tickets. This is often used for things such as current usernames & passwords, etc... These are configured in Setup > Support Departments

Displaying Custom Fields on Invoices

There are times when you might want custom fields to appear on invoices. Just 2 examples of what you might find this useful for are:

  • If you have a client custom field for a Tax ID or VAT Number
  • If you have a product custom field containing a Username or Reference for the clients product

So how do you do it? Well it's really simple. Both the client & product field types support this, and to enable it all you need to do is tick the checkbox labelled Show on Invoice where you configure the custom fields (either in Setup > Client Custom Fields or the Custom Fields tab of the product config).

In the case of client custom fields, they will then be shown under the name & address information on the invoice, and in the case of product custom fields they show as part of the line item descriptions for those products.

Regular Expression Validation

The regular expression validation rules allow you to define what value the field can take. The user won't be allowed to proceed until it passes the validation rule. Some common examples you might want:

A username between 4 and 28 characters in length, alpha-numeric, and allowing underscores

/^[a-z\d_]{4,28}$/i

A telephone number in the following format: (###) ###-####

/^(\(?[0-9]{3,3}\)?|[0-9]{3,3}[-. ]?)[ ][0-9]{3,3}[-. ]?[0-9]{4,4}$/

A date in the format DD/MM/YYYY

/^\d{1,2}\/\d{1,2}\/\d{4}$/

See http://www.regexpr.com/cheatsheet/ for a detailed guide