---
sourceDocument: Xanadu ServiceNow AI Platform Administration
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/platform-administration

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu ServiceNow AI Platform Administration

ft:clusterId :

    - platadm

bundleId :

    - platadm

workflow :

    - Platform


---

# Create a function field to perform a database function

# Create a function field to perform a database function {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read

Create a function field that displays the results of a database function, such as a
mathematical operation, field length computation, or day of the week
calculation.

## Before you begin

Role required: admin

You can either select a function field from a physical table or create a function field directly on the database view.

If you create a function field directly on the database view, you must use the variable prefixes from the database view in the function definition to identify the columns. Before you create the function field, take note of the
variable prefixes in your database view.

For example, if the variable prefix for the Incidents table is <kbd class="ph userinput">inc2</kbd> and you want to return the length of the description field, the function definition would be
<kbd class="ph userinput">glidefunction:length(inc2_description)</kbd>. If the variable prefix for the Metric Instance table is <kbd class="ph userinput">mi</kbd> and you want to concatenate the Definition and Value fields, the function
definition would be <kbd class="ph userinput">glidefunction:concat(mi_definition.name,' ',mi_value)</kbd>.

For information on supported functions, see [Report on function fields](https://www.servicenow.com/docs/access?context=function-fields-reporting&version=xanadu&pubname=xanadu-now-intelligence&ft:locale=en-US).

## Procedure

1. Navigate to AllSystem DefinitionDictionary.
2. Select New.
3. Select Function field.
4. On the form, fill in the fields.  
   {#create-a-function-field-to-perform-a-database-function__table_lbr_qbf_xtb__entry__2}

   | Field | Description |
   |-|-|
   | Table | The table or database view to which the function field is added. If you select a database view, you must include the database view's variable prefixes in the Function definition field. |
   | Type | The type of field: string, number, date, and so on. |
   | Column label | The label for the column. |
   | Column name | The name of the column. This field is automatically set to the value of the Column label field. |
   | Max length | The maximum length of the return value. |
   | Function field | If selected, creates a field that displays the results of a database function, such as a mathematical operation, field length computation, or day of the week calculation. Once the new function record is saved, you cannot clear the check box to make the field a regular field. |
   | Function definition | The function that the field performs. The format for functions starts with <kbd class="ph userinput">glidefunction:</kbd>, followed by the operation to be performed (for example, <kbd class="ph userinput">concat</kbd>), followed by function parameters. Constants must be enclosed in single quotes. Important: If you create the function field on a database view and not a physical table, you must include the database view's variable prefixes in the Function definition field. |
   [Table 1. Function fields form]

   {#create-a-function-field-to-perform-a-database-function__table_lbr_qbf_xtb}
5. Select Submit.

## Create a Function field on the Incident Metric database view {#create-a-function-field-to-perform-a-database-function__example_vsk_jqg_c5b}

In this example, a new Function field, CallerDesc, is added to the Incident Metric
database view. The field concatenates the caller name, a hyphen, and the short
description.

The variable prefix <kbd class="ph userinput">inc</kbd> is included because the function field
is defined on the Incident Metric database view and not on a physical table. The
prefix is necessary to distinguish which short_description and caller_id columns to
use from the tables that are part of the database view.

## What to do next

[Display function results in a database view](https://servicenow-prod.fluidtopics.net/evIeZUk3P17TX0uqlPaLTA "Add a function field to the output of a database view to see function results.")

*[\>]: and then


