Live Field Developer Guide - Javascript
The Live Fields Javascript interpreter exposes a number of helpers to empower rule building. The elements can be used throughout your Javascript.
Live Fields are part of a GlobalSearch database’s standard field catalog. To create a Live Field, start as you would when creating any database field. Beginning in GlobalSearch 6.3, an option exists to provision a field as a Live Field.

Existing fields can not be converted to Live Fields and vice-versa. This option is only available when creating a new field in the catalog.
Creating a Live Field
The required elements of this field type include a Field Name and some Javascript to execute. Advanced options do exist for making requests to external API sources and databases. For the purposes of this guide, we will focus on Javascript.
Injectable Properties
$$inject.fields
This property contains a dictionary of getter/setters representing all the fields in the indexer. The values can be accessed by a key of either their field ID or the field's name.
$$inject.fields['Field Name or FieldID'] = 'Value';
Implement the feature as follows:
$$inject.fields['Account Name'] = ‘ABC Co.';
This will set a value of the Account Name index field to ABC Co. Setting a value marks the indexer as dirty, so save’s will be allowed.
$$inject.fieldProperties
Note this feature is only available to users of GlobalSearch Go
Manipulate field properties to control viewer behaviors or user accessibility to data. The following field properties can be altered:
.required = true;
.readOnly = true;
$$inject.fieldProperties['Name of Field'].required = true;
$$inject.fieldProperties['Name of Field'].readOnly = true;
Implement the feature as follows:
$$inject.fieldProperties['Vendor Name'].required = true;
This will make the Vendor Name index field required.
$$inject.fieldProperties['Vendor Name'].readOnly = true;
This will make the Vendor Name index field read only.
$$inject.ui
Note this feature is only available to users of GlobalSearch Go
Allows access and manipulation of certain UI elements.
.setUserActionState('Approve', false, 'Approval disabled by script.');
$$inject.ui.setUserActionState('Name of GlobalActon Button', True or False, 'Message to User');
True - Button is enabled, False - Button is disabled.
The Message to User appears when the user hovers over the GlobalAction button.
Implement the feature as follows:
$$inject.ui.setUserActionState('Approve', false, 'Approval disabled by script.');
This will control the availability of a specific GlobalAction button by named Approve. It will be disabled for the user (false) and will display the message “Approval disabled by script.” when the user hovers over the button.
$$inject.tableFields
This property contains a dictionary of table fields available to the indexer. This is only relevant when the archive has a table field assigned to it.
The table field can be accessed by name as
$$inject.tableFields['Name of Tablefield'], the table field will have the following properties:
Dictionary of
.columns, which provides a$$sumproperty.i.e.
$$inject.tableFields['Line Items'].columns['Amount'].$$sum
.$$rowCountproperty to get the number of rows in the table field. Empty rows of data are not included..$$rawData()function to get a 2D array of the table’s data..$$add(arr)wherearris an array of values to add as a new row, the length ofarrshould match the length of fields/columns in the table. The values will be cast to strings if they are not already..$$clear()removes all values from the table field.
Users of GlobalSearch Go should note that operating against a table field requires the table field panel to open. $$inject.tableFields['Name of Tablefield'] will return in the table field opening when the script executes.
Previous GlobalSearch version required manipulation of the DOM to perform certain actions, like opening the table field control. DOM manipulations in Go are generally blocked and should be avoided where not specifically blocked.
$$inject.setPendingChanges()
This function will mark the indexer as dirty without requiring a field to be set.
$$inject.save()
This function will invoke a save of the document.
setInterval(function (){ $$inject.save(); }, 60000);
$$inject.properties
A useful set of document and Square9API related properties are exposed for convenience:
.authTokenauthentication token..configexposed viewer application configuration properties object (i.e.; square9ApiUrl, etc.)..document.iddocument ID..document.hashdocument SecureID search hash..document.databaseIddatabase ID..document.archiveIdarchive ID..document.fileIdviewer cache file ID.
$$inject.notify
A notification service object, provided strings are output to the notification menu (bell icon), containing the following functions
.info()log an info message..warn()log an warning message..error()log an error message..success()log an success message.
Additionally, a toast message can be shown with .toast().
$$inject.notify.toast("This is a viewer toast message.");
x