**Operation**:add()

**Description:**

Takes two number fields as input, adds them, and returns the results as a field value.

This function also takes numerical values for either input. Place numerical values in single or double quotation marks.

**Example:**

glidefunction:add(child_incidents, parent_incident)

Returns 6 if the incident has five child incidents and one parent incident.

Possible return types: Decimal, Floating Point Number, Large Whole Number, Whole Number

**Operation: **concat()

**Description:**

Takes any number of comma-separated fields and constants as input, concatenates the input, and returns a single string as a field value.

**Example:**

glidefunction:concat(incident_number, '/', short_description)

Returns "INC0001 / My client needs a new laptop." if the value of the number field is 'INC0001' and the short_description is 'My client needs a new laptop'.

Return type: Text

**Operation: **coalesce()

**Description**

Takes any number of comma-separated fields as input and returns the first non-empty value.

**Example**

glidefunction:coalesce(closed_at, resolved_at, sys_updated_on)

If the value of closed_at is empty, the function returns the value of resolved_at. If the value of resolved_at is also empty, the function returns the value of sys_updated_on.

Return type: Text

**Operation: **divide()

**Description**

Takes two number fields as input, divides the first by the second, and returns the result as a field value.

This function also takes numerical values for either input. Place numerical values in single or double quotation marks.

**Example**

glidefunction:divide(u_num2,u_num1)

Returns 5 if num2 = 10 and num1 = 2.

Possible return types: Decimal, Floating Point Number, Large Whole Number, Whole Number

**Operation: **datediff()

**Description**

Takes two date/time fields as input, calculates the difference between the dates in days, minutes, and seconds, and returns the results as a duration field value.

**Example**

glidefunction:datediff(closed_at, sys_created_on)

Returns the duration of an incident from the creation date to the close date. Example result: 10 days, 8 hours 23 minutes 11 seconds

Return type: Duration

**Operation: **dayofweek()

**Description**

Takes two arguments: A date field and a constant of either '1' (week starts on Sunday) or '2' (week starts on Monday). Returns the results as an integer value that represents the day of the week.

The dayofweek() function uses UTC dates, but adjusts comparison values based on the instance's time zone.

**Example**

glidefunction:dayofweek(resolved_at, '1').

If resolved_at occurs on a Wednesday, returns 4 if the integer is 1 and returns 3 if the integer is 2.

Return type: Whole number

**Operation: **distance_sphere()

**Description**

Takes two locations and returns the distance between them in meters.

**Example**

- glidefunction:distance_sphere('-0.189937', '51.473584', '80.206458', '25.767242')Returns the distance between the two sets of longitude and latitude pairs.
- glidefunction:distance_sphere(u_location, '80.206458', '25.767242')Returns the distance between the u_location geo point field and the longitude and latitude coordinates.
- glidefunction:distance_sphere(location1, location2)Returns the distance between the location1 and location2 geo point fields.
- glidefunction:divide(distance_sphere(location1, '-0.189937', '51.473584'), '1000')Returns the distance between the location1 geo point field and London in kilometers.

Return type: Decimal

**Operation:**greatest()

**Description**

Takes two or more values as input and returns the greatest value of the list of arguments.

**Example**

glidefunction:greatest(10,100,1000)

Returns 1000

Possible numeric return types: Decimal, Floating Point Number, Large Whole Number, Whole Number

This function also works with date and string fields.

**Operation: **least()

**Description**

Takes two or more values as input and returns the lowest value of the list of arguments.

**Example**

glidefunction:least(10,100,1000)

Returns 10

Possible numeric return types: Decimal, Floating Point Number, Large Whole Number, Whole Number

This function also works with date and string fields.

**Operation: **length()

**Description**

Takes a string field as input, calculates the field length in characters, and returns the results as a field value.

**Example**

glidefunction:length(short_description)

Returns 37 if short_description = "This application is performing a test".

Return type: Whole number

**Operation: **multiply()

**Description**

Takes two number fields as input, performs the multiplication, and returns the results as a field value.

This function also takes numerical values for either input. Place numerical values in single or double quotation marks.

**Example**

glidefunction:multiply(u_num1, u_num2)

Returns 48 if num1 = 8 and num_2 = 6.

Possible return types: Decimal, Floating Point Number, Large Whole Number, Whole Number

**Operation: **position()

**Description**

Takes two text fields or two text fields and a whole number as input. One or both of the text fields can also be strings.

- Returns the position of the first occurrence of the string of the first text field in the second.
- If a whole number is specified, this function returns the position of the second text field after the position of the whole number.

Returns 0 if the first text field is not present in the second (after the position of the whole number if specified).

**Example**

- glidefunction:position('e',short_description)If the value of the short_description field is "This computer is performing an upgrade", returns 12.
- glidefunction:position('e',short_description,'14')If the value of the short_description field is "This computer is performing an upgrade", returns 19.

Return type: Whole number

**Operation: **substring()

**Description**

Takes a text field and two whole numbers as input. Returns the first instance of a string that starts at the position of the first whole number and is the length of the second.

**Example**

glidefunction:substring(short_description, '7', '2')

If the value of the short_description field is 'We're going to the store', returns 'go'.

Return type: Text

**Operation: **subtract()

**Description**

Takes two number fields as input, subtracts the second from the first, and returns the result as a field value.

**Example**

glidefunction:subtract(u_num1, u_num2)

Returns 2 if num1 = 8 and num_2 = 6.

Possible return types: Decimal, Floating Point Number, Large Whole Number, Whole Number