Value formulas

You can define a business rule that sets a field's value based on the evaluation of a JavaScript formula.

Overview

The JavaScript formula can consist of a single JavaScript expression on a single line. The result of the expression must match the value type of the field that is being set. There is no validation of the type match. The supported functions, methods, and operators are listed in the sections below.

As you type the expression in the formula box, autocomplete suggests the right fields and functions.

Aviator: In the Aviator box, you can describe the calculation in your own words. Aviator will convert your description into a JavaScript formula.

Referencing properties

References to field properties can follow either of these syntaxes: entity.<property> or entity['<property>']

Example: entity.story_points, entity['story_points']

Back to top

Math operations

The following math functions and operators are supported.

Function or operator Example Description
min(e1,e2, ...) Math.min(entity[‘story_points’],entity[‘actual_story_points’],entity[‘udf’],...) Returns the smallest of the given expressions.
max(e1,e2, ...) Math.max(entity[‘story_points’],entity[‘actual_story_points’],entity[‘udf’],...) Returns the biggest of the given expressions.
abs(expression) Math.abs(entity[‘udf’]) Returns the absolute (non-negative) value of the expression.
round(expression) Math.round(entity[‘udf’]) Rounds a value to the nearest integer value.
floor(expression) Math.floor(entity[‘story_points’]/entity[‘actual_story_points’]) Rounds the value down to the nearest integer.
ceil(expression) Math.ceil((entity[‘score_udf’]+entity[‘business_udf’])*entity[‘story_points’]) Rounds the value up to the nearest integer.
trunc(expression) Math.trunc((entity[‘score_udf’]-entity[‘business_udf’])*entity[‘story_points’]) Returns the integer part of the expression
pow(x,y) Math.pow(x,y) Returns x raised to the power of y (x^y)
avg(t1,t2,...) MathUtils.avg(entity[‘story_points’],entity[‘estimated_time’], entity[‘initial_estimation’], ...) Returns the average value of the terms
+ entity[‘story_points’] + entity[‘bucket_rank_udf’] +... Plus
- entity[‘story_points’] - entity[‘actual_story_points’] -... Minus
* entity[‘story_points’] * entity[‘bucket_rank_udf’] *... Multiply
/ entity[‘story_points’] / entity[‘bucket_rank_udf’] Divide
% (entity[‘story_points’] % entity[‘actual_story_points’]) Returns the integer remainder of dividing the two operands. For example, 12 % 5 returns 2
== entity[‘story_points’].value == entity[‘actual_story_points’].value Equality operator
!= entity[‘story_points’].value != entity[‘actual_story_points’].value Inequality operator
entity[‘story_points’] > entity[‘actual_story_points’] Greater than
entity[‘story_points’] < entity[‘actual_story_points’] Less than
>= entity[‘story_points’] >= entity[‘actual_story_points’] Greater or equal
<= entity[‘story_points’] <= entity[‘actual_story_points’] Less or equal
&& (entity[‘story_points’] > entity[‘actual_story_points’]) && (entity[‘bucket_rank’] < entity[‘udf']) And
|| (entity[‘story_points’] > entity[‘actual_story_points’]) || (entity[‘bucket_rank’] < entity[‘udf']) Or
! !(entity[‘story_points’] > entity[‘actual_story_points’]) Not
?

(entity['story_points'] > entity['actual_story_points']) ? entity['story_points'] : entity['actual_story_points']

Ternary operator

Back to top

String operations

The following string methods and operators are supported.

Method or operator Example Description
==, != entity[‘ID’].value == entity[‘string_udf’].value Evaluates whether two strings are identical or different.
length entity[‘string_udf’].length Returns the length of a string.
substring(start,end) entity[‘string_udf’].substring(3,8) Extracts a substring starting from the first parameter index up to the second parameter.
substr(start,length) entity[‘string_udf’].substr(2,5) Extracts a string starting at the start index, the second parameter being the length of the extracted string.
toUpperCase() entity[‘string_udf’]. toUpperCase() A string is converted to upper case
toLowerCase() entity[‘string_udf’].toLowerCase() A string is converted to lower case
concat(text1,text2,…) entity[‘string_udf’].concat(“ ”, “Nice try”) Joins two or more strings
trim() entity[‘string_udf’].trim() Removes whitespace from both sides of a string.
trimStart() entity[‘string_udf’].trimStart() Removes whitespace only from the start of a string.
trimEnd() entity[‘string_udf’].trimEnd() Removes whitespace only from the end of a string.
includes(text) entity[‘string_udf’].includes(“Is it there?”) Checks if a string contains a specified substring. Returns true or false.
indexOf(text) entity[‘string_udf’].indexOf(“Where?”) Returns the index of the first occurrence of a specified substring or -1 if not found.
lastIndexOf(text) entity[‘string_udf’].lastIndexOf(“Where?”) Returns the index of the last occurrence of a specified substring or -1 if not found.

Back to top

Date operations

The following date methods and operators are supported.

Method or operator Example Description
current() Date.current() Creates a new object representing the current date and time.
now() Date.now() Returns the number of milliseconds since January 1, 1970, UTC (the Unix epoch).
parse('YYYY-mm-ddThh:mm') Date.parse('2025-07-13T08:42') Parses a string representation of a date, and returns the date's timestamp.
toUTCString() entity[‘creation_time’].toUTCString() Converts a date to a string using the UTC standard.
toDateString() entity[‘creation_time’].toDateString() Converts a date to a more readable format.
toISOString() entity[‘creation_time’].toISOString() Convert a date to a string using the ISO standard.
getYear() entity[‘creation_time’].getYear() Returns the year of a date as an integer relative to 1900.
getMonth() entity[‘creation_time’].getMonth() Get month as a number (0-11)
getDate() entity[‘creation_time’].getDate() Get day as a number (1-31)
getDay() entity[‘creation_time’].getDay() Get weekday as a number (0-6)
getHours() entity[‘creation_time’].getHours() Get hour (0-23)
getMinutes() entity[‘creation_time’].getMinutes() Get minute (0-59)
isEqual(date1, date 2) DateUtils.isEqual(entity['done_date'], entity['last_modified'])

Checks if the values of two date fields are equal.

'==' and '!=' are not supported for date fields.

>, <, >=, <= Date.current() <= DateUtils.addWeeksToDate(entity['creation_time'], 2) Checks inequalities of date fields.
diffInMinutes(date1,date2) DateUtils.diffInMinutes(date1,date2) Difference between two date fields in minutes.
diffInHours(date1,date2) DateUtils.diffInHours(date1,date2) Difference between two date fields in hours.
diffInDays(date1,date2) DateUtils.diffInDays(date1,date2) Difference between two date fields in days.
diffInWeeks(date1,date2) DateUtils.diffInWeeks(date1,date2) Difference between two date fields in weeks.
diffInMonths(date1,date2) DateUtils.diffInMonths(date1,date2) Difference between two date fields in months.
diffInYears(date1,date2) DateUtils.diffInYears(date1,date2) Difference between two date fields in years.
addSecondsToDate(date, seconds) DateUtils.addSecondsToDate(entity['creation_time'],55) Adds seconds to the date field value.
addMinutesToDate(date, minutes) DateUtils.addMinutesToDate(entity['creation_time'], 30) Adds minutes to the date field value.
addHoursToDate(date, hours) DateUtils.addHoursToDate(entity['creation_time'], 2) Adds hours to the date field value.
addDaysToDate(date,days) DateUtils.addDaysToDate(entity['creation_time'], 2) Adds days to the date field value.
addWeeksToDate(date,weeks) DateUtils.addHoursToDate(entity['creation_time'], 2) Adds weeks to the date field value.
addMonthsToDate(date,months) DateUtils.addMonthsToDate(entity['creation_time'], 2) Adds months to the date field value.
DateUtils.addYearsToDate(date, years) DateUtils.addYearsToDate(entity['creation_time'],2) Adds years to the date field value.
subtractMinutes(date,minutes) DateUtils.subtractMinutes(entity['last_modified'],55) Subtracts minutes from a date field value.
subtractHours(date,hours) DateUtils.subtractHours(entity['last_modified'],2) Subtracts hours from a date field value.
subtractDays(date,days) DateUtils.subtractDays(entity['last_modified'],3) Subtracts days from a date field value.
subtractWeeks(date,weeks) DateUtils.subtractWeeks(entity['last_modified'],2) Subtracts weeks from a date field value.
subtractMonths(date, years) DateUtils.subtractMonths(entity['last_modified'],2) Subtracts months from a date field value.
subtractYears(date, years) DateUtils.subtractYears(entity['last_modified'],1) Subtracts years from a date field value.

Back to top

Miscellaneous operations

The following miscellaneous functions and methods are supported.

Function or method Example Description
without(expression, value) without(enity.children.points, null) Removes the value of the RHS from the collection of the LHS.
count(collection) CollectionUtils.count(entity.product_areas)

Returns the number of items in the collection.

Examples of collections: application modules, multi value lists, teams

length entity.product_areas.length Gets the number of items that are set to a multi-valued field

Back to top