Reference
Last updated 30/10/2024
Five Object
The
Five
object is the main object that will help you interact with Five. The Five
object is a standalone entity
with the following properties and functions.
Properties
field
The field
property is on the
Five
object and will return the value associated to the fieldID
on the current form.
The form
property is on the
Five
object and will return the value associated to the combination of the actionID
and the fieldID
for the form in the stack.
five.form.<actionID>.<fieldID>
The headers
property is on the
Five
object and contains the values provided as HTTP request headers via public URLs.
parameters
The parameters
property is on the
Five
object and contains the values provided as URL parameters in a HTTP request via public URLs.
stack
The stack
property is on the
Five
object and will return the primary key for the associated table in the stack.
five.stack.<tableId>.<primaryKey>
variable
The variable
property is on the
Five
object and will return values set from the setVariable()
function.
five.variable.<variableID>
Functions
actionID()
The actionID()
is a function on the
Five
object that returns the current action ID.
addAttachment()
The addAttachment()
is a function on the
Five
object and can be called during a mail merge action being executed.
Function Signature
addAttachment(attachment: string, name: string) : FiveError;
addFilter()
The addFilter()
is a function on the
Five
object that adds a key and its value to the Five stack.
Function Signature
addFilter(keyName: string, key: string) : void;
authentication()
The authentication()
is a function on the
Five
object that returns authentication details for the current REST/OData session.
Function Signature
authentication() : AuthenticationInfo
clearFilter()
The clearFilter()
is a function on the
Five
object that deletes a previously added value in the stack.
Function Signature
clearFilter(keyName: string) : void;
clearVariable()
The clearVariable()
is a function on the
Five
object that clears a previously set global variable.
Function Signature
clearVariable(name: string) : any;
clientAddress()
The clientAddress()
is a function on the
Five
object that returns the network address of the client.
Function Signature
clientAddress() : string;
commit()
The commit()
is a function on the
Five
object that commits a database transaction.
Function Signature
commit(tx: Transaction) : FiveError;
createError()
The createError()
is a function on the
Five
object that creates an Error
object with a message describing the error.
Function Signature
createError(currentResult: FiveError | message: string, [message: string]) : FiveError;
currentUserKey()
The currentUserKey()
is a function on the
Five
object that returns the current logged in user.
Function Signature
currentUserKey() : string;
currentUserRecordKey()
The currentUserRecordKey() is a function that returns the user record associated to the current user.
Function Signature
currentUserRecordKey() : string;
date()
The date()
is a function on the
Five
object that returns the current local date as a string.
dateTime()
The dateTime()
is a function on the
Five
object that returns the current local date and time as a string.
dateTimeLocalToUTC()
The dateTimeLocalToUTC()
is a function on the
Five
object that converts a local date and time to a UTC timestamp.
Function Signature
dateTimeLocalToUTC(localDateTime: string) : string;
dateTimeUTCToLocal()
The dateTimeUTCToLocal()
is a function on the
Five
object that converts a UTC timestamp to a local date and time.
Function Signature
dateTimeUTCToLocal(timestamp: string) : string;
The displayCustomForm()
is a function on the
Five
object that displays a custom form.
Function Signature
displayCustomForm(actionID: string) : void;
emailAddress()
The emailAddress()
is a function on the
Five
object that returns an email address object to pass into a mail merge action.
Function Signature
emailAddress(email: string, [name: string]) : EmailAddress;
executeAction()
The executeAction()
is a function on the
Five
object that executes an action.
Function Signature Server Side
executeAction(actionID: string, [context: any, [at: Date]]) : FiveError;
Function Signature Client Side
executeAction(actionID: string, context: any, [onResult: (results: FiveError) => void]) : FiveError;
executeConnection()
The executeConnection()
is a function on the
Five
object that allows calling a pre-configured connection in your application.
Function Signature
executeConnection(dataSourceID: string, method: string, options: ConnectionContext) : ConnectionResult
executeFunction()
The executeFunction()
is a function on the
Five
object that executes a function on the server.
Function Signature
executeFunction(
functionID: string,
variables: Map<string, any>,
file: File,
actionKey: string,
functionKey: string,
[ onResultsCallBack: (results: any) => void) : void ])
executeQuery()
The executeQuery()
is a function on the
Five
object that executes SQL statements on the Five server and returns results.
Function Signature
executeQuery([transaction,] query[, limit[, ...parameters]]) : QueryResult;
getDatabaseConnectionByID()
The getDatabaseConnectionByID()
is a function on the
Five
object that returns an external database connection using its database ID.
Function Signature
getDatabaseConnectionByID(databaseID: string) : DatabaseConnection;
The getMetadata()
is a function on the
Five
object that gets metadata from a field.
Function Signature
getMetadata([ formID: string ], fieldID: string, metadataID: string) : any;
getOption()
The getOption()
is a function on the
Five
object that returns a value of an option configured in the Options field against the instance of the running application.
Function Signature
getOption(key: string) : string;
getRoleKey()
The getRoleKey()
is a function on the
Five
object that gets a rolekey from the internal Role table.
Function Signature
getRoleKey(name: string) : string;
The getSelectedMenuID()
is a function on the
Five
object that returns the current selected menu ID.
Function Signature
getSelectedMenuID() : string;
getVariable()
The getVariable()
is a function on the
Five
object that will return values set from the setVariable()
function.
Function Signature
getVariable(name: string) : any;
httpClient()
The httpClient()
is a function on the
Five
object that creates and returns a new HTTPClient
object.
Function Signature
httpClient() : HTTPClient;
isCreate()
The isCreate()
is a function on the
Five
object that returns true if the action is currently creating a record.
isEdit()
The isEdit()
is a function on the
Five
object that returns true if the action is currently editing a record.
isMobile()
The isMobile()
is a function on the
Five
object that returns true if the user interface is running in mobile mode.
log()
The log()
is a function on the
Five
object that writes a message to Five's Inspector.
maxField()
The maxField()
is a function on the
Five
object that returns the maximum value from the array of records associated to the field ID.
Function Signature
maxField(records: Array<FiveRecord>, fieldID: string) : number;
minField()
The minField()
is a function on the
Five
object that returns the minimum value from the array of records associated to the field ID.
Function Signature
minField(records: Array<FiveRecord>, fieldID: string) : number;
now()
The now()
is a function on the
Five
object that returns the current date and time in UTC as a string.
open()
The open()
is a function on the
Five
object that opens the supplied URI.
Function Signature
open(uri: string) : void;
previousAction()
The previousAction()
is a function on the
Five
object that returns to the previously selected or replaced action.
Function Signature
previousAction(revertSelect: boolean [, num: number = 1]) : void;
question()
The question()
is a function on the
Five
object that gets a result back from the OpenAI platform.
Function Signature
question(question: string, onResultsCallBack: (reply: string) => void) : string
refreshTable()
The refreshTable()
is a function on the
Five
object that refreshes any live queries associated to the table ID.
Function Signature
refreshTable(tableID: string) : void;
rollback()
The rollback() is a function that rollbacks a database transaction.
Function Signature
rollback(tx: Transaction) : FiveError;
selectAction()
The selectAction()
is a function on the
Five
object that selects an action to take the place of the current action without leaving the current menu.
Function Signature
selectAction(actionId: string [, recordKey: string]) : void;
selectFile()
The selectFile() is a function that opens a file opened dialog for a user to select a file.
Function Signature
selectFile(context: any, acceptedExtensions: Array<string>) : FiveError;
The selectMenu() is a function that selects a menu and opens the record specified by the record keys.
Function Signature
selectMenu(menuID: string, ...recordKeys: Array<string>) : void;
sender()
The sender() is a function that returns the sender associated with the event callback.
sendNotification()
The sendNotification()
is a function on the
Five
object that sends a notification to the client, where it will display in the UI.
Function Signature
sendNotification(userKey: string, notification: string) : void;
setVariable()
The setVariable()
is a function on the
Five
object that sets a global variable.
Function Signature
setVariable(name: string, value: any) : void;
showAgreement()
The showAgreement()
is a function on the
Five
object that displays an agreement.
Function Signature
showAgreement(terms: string, onUserResult: (userResult: any) => void) : void
showError()
The showError() is a function that shows an error dialog with the supplied message.
Function Signature
showError(message: string) : void;
showMessage()
The showMessage()
is a function on the
Five
object that is used to display a message to the client that will be displayed in the UI.
Function Signature
showMessage(message: string) : void;
startTransaction()
The startTransaction()
is a function on the
Five
object that starts a transaction with a database connection.
Function Signature
startTransaction(db: DatabaseConnection) : Transaction;
success()
The success()
is a function on the
Five
object that returns a FiveErrorSuccess
object indicating success.
Function Signature
success([currentResult: FiveError | message: string, [message: string]]) : FiveErrorSuccess;
sumField()
The sumField()
is a function on the
Five
object that returns the sum of all the values from the array of records associated to the field ID.
Function Signature
sumField(records:Array<FiveRecord>, fieldID: string) : number;
time()
The time()
is a function on the
Five
object that returns the current local time as a string.
toDataURL()
The toDataURL()
is a function on the
Five
object that encodes the contents supplied in the data parameter as a data URI.
Function Signature
toDataURL(mimeType: string, data: string): string;
uuid()
The uuid() is a function that returns a unique identifier.