Smart Script functions
Find every public method exposed by FunctionManager. Use the signatures below when writing calls in the editor.
loadValueByClause
FunctionManager.loadValueByClause(targetFieldName, targetModuleId, clause)Reads one field from the first matching record.
Group: Single values
targetFieldName- Field system name in the selected module; use the name, not its translated label.
targetModuleId- Module id as a string, or its table name. The code accepts both.
clause- Filter clause beginning with WHERE and full table.field names. Use ids for lookup comparisons.
Returns: A string; "" when no non-empty successful result is available.
- Use a field system name that exists in the target module.
FunctionManager.loadValueByClause("reference", "contracts", "WHERE contracts.reference = 'CTR-2026-014'")replaceText
FunctionManager.replaceText(text, charToReplace, textReplace)Replaces every occurrence of literal text.
Group: Formatting
text- Input text.
charToReplace- Literal text to replace, or a regular expression for replaceTextRegex.
textReplace- Replacement text; regex replacement follows Java String.replaceAll rules.
Returns: The replaced string.
- Uses Java String.replace, not regular expressions.
FunctionManager.replaceText("CTR/2026/014", "/", "-")replaceTextRegex
FunctionManager.replaceTextRegex(text, charToReplace, textReplace)Replaces matches of a regular expression.
Group: Formatting
text- Input text.
charToReplace- Literal text to replace, or a regular expression for replaceTextRegex.
textReplace- Replacement text; regex replacement follows Java String.replaceAll rules.
Returns: The replaced string.
- Uses Java String.replaceAll; invalid regex patterns can raise errors.
FunctionManager.replaceTextRegex("CTR 2026", " +", "-")loadRecordsByClause
FunctionManager.loadRecordsByClause(targetModuleId, clause)Loads matching records.
Group: Load records
targetModuleId- Module id as a string, or its table name. The code accepts both.
clause- Filter clause beginning with WHERE and full table.field names. Use ids for lookup comparisons.
Returns: A Java ArrayList of RecordModel, or null when no non-empty successful result is available.
- Check for null before iterating with .forEach.
- Use the paged variant to read records in batches.
- Use lowercase text in the filter clause.
var records = FunctionManager.loadRecordsByClause("invoices", "WHERE invoices.status = '3'");
var total = 0;
if (records != null) {
records.forEach(function (record) {
total += parseFloat(record.getFieldValueMap().get("amount").getCurrentValue()) || 0;
});
}
total;loadRecordsByClausePaged
FunctionManager.loadRecordsByClausePaged(targetModuleId, clause, limit, offset)Loads one page of matching records.
Group: Load records
targetModuleId- Module id as a string, or its table name. The code accepts both.
clause- Filter clause beginning with WHERE and full table.field names. Use ids for lookup comparisons.
limit- Number of records to request for the page.
offset- Number of records to skip before loading this page.
Returns: A Java ArrayList of RecordModel, or null when no non-empty successful result is available.
- Supply a positive page size and a nonnegative offset.
- Check for null before iterating with .forEach.
- Use the sortable paged variant to control ordering.
var records = FunctionManager.loadRecordsByClausePaged("invoices", "WHERE invoices.status = '3'", 100, 0);
var count = 0;
if (records != null) { records.forEach(function () { count += 1; }); }
count;loadRecordsByClauseSortable
FunctionManager.loadRecordsByClauseSortable(targetModuleId, clause, orderFieldName, orderType)Loads matching records in a specified order.
Group: Load records
targetModuleId- Module id as a string, or its table name. The code accepts both.
clause- Filter clause beginning with WHERE and full table.field names. Use ids for lookup comparisons.
orderFieldName- Field used to order the results.
orderType- Sort direction, such as ASC or DESC.
Returns: A Java ArrayList of RecordModel, or null when no non-empty successful result is available.
- Check for null before iterating with .forEach.
- Use the sortable paged variant to read records in batches.
var records = FunctionManager.loadRecordsByClauseSortable("invoices", "WHERE invoices.status = '3'", "due_date", "ASC");
var count = 0;
if (records != null) { records.forEach(function () { count += 1; }); }
count;loadRecordsByClauseSortablePaged
FunctionManager.loadRecordsByClauseSortablePaged(targetModuleId, clause, orderFieldName, orderType, limit, offset)Loads an ordered page of matching records.
Group: Load records
targetModuleId- Module id as a string, or its table name. The code accepts both.
clause- Filter clause beginning with WHERE and full table.field names. Use ids for lookup comparisons.
orderFieldName- Field used to order the results.
orderType- Sort direction, such as ASC or DESC.
limit- Number of records to request for the page.
offset- Number of records to skip before loading this page.
Returns: A Java ArrayList of RecordModel, or null when no non-empty successful result is available.
- Supply a positive page size, a nonnegative offset, a sort field and a direction.
- Check for null before iterating with .forEach.
var records = FunctionManager.loadRecordsByClauseSortablePaged("invoices", "WHERE invoices.status = '3'", "due_date", "ASC", 100, 0);
var count = 0;
if (records != null) { records.forEach(function () { count += 1; }); }
count;evaluateSumFunction
FunctionManager.evaluateSumFunction(targetFieldName, targetModule, clause)Totals the selected field over matching records.
Group: Aggregates
targetFieldName- Field system name in the selected module; use the name, not its translated label.
targetModule- Module id as a string, or its table name.
clause- Filter clause beginning with WHERE and full table.field names. Use ids for lookup comparisons.
Returns: A numeric string, formatted with 2 decimal places; "0" on the fallback path.
- Quote string values in the clause.
- Parse the result with parseFloat before arithmetic.
parseFloat(FunctionManager.evaluateSumFunction("amount", "invoices", "WHERE invoices.status = '3'")) || 0;evaluateAverageFunction
FunctionManager.evaluateAverageFunction(targetFieldName, targetModule, clause)Reads the average of the selected field over matching records.
Group: Aggregates
targetFieldName- Field system name in the selected module; use the name, not its translated label.
targetModule- Module id as a string, or its table name.
clause- Filter clause beginning with WHERE and full table.field names. Use ids for lookup comparisons.
Returns: The service’s numeric string; "0" on the fallback path.
- Quote string values in the clause.
- Parse the result with parseFloat before arithmetic.
parseFloat(FunctionManager.evaluateAverageFunction("amount", "invoices", "WHERE invoices.status = '3'")) || 0;evaluateCount
FunctionManager.evaluateCount(targetModule, clause)Counts records matching the clause.
Group: Aggregates
targetModule- Module id as a string, or its table name.
clause- Filter clause beginning with WHERE and full table.field names. Use ids for lookup comparisons.
Returns: The total count as a string on success, including "0"; "" on the failure or missing-module fallback path.
- Quote string values in the clause.
- Check for an empty string before parsing the count.
var countText = FunctionManager.evaluateCount("invoices", "WHERE invoices.status = '3'");
countText === "" ? "Could not count invoices" : parseInt(countText, 10);getSubListFromContext
FunctionManager.getSubListFromContext(targetModule, listField)Reads a nested record list from the first record of a module in context.
Group: Users and context
targetModule- Module id as a string, or its table name.
listField- System name of the field containing a nested record list.
Returns: The matched field’s record list, which can be null; a new empty Java ArrayList when the module or field is not found.
- Reads the nested list from the first context record.
- Check for null before iterating.
var lines = FunctionManager.getSubListFromContext("purchase_orders", "lines");
var count = 0;
if (lines != null) { lines.forEach(function () { count += 1; }); }
count;getListFromContext
FunctionManager.getListFromContext(listName)Reads a named record list already held in the interpreter context.
Group: Users and context
listName- Name of a record list already available in the current script context.
Returns: The existing non-empty list, otherwise a new empty Java ArrayList.
- Load the named list into the current script context before reading it.
var invoices = FunctionManager.getListFromContext("openInvoices");
var count = 0;
invoices.forEach(function () { count += 1; });
count;resolveLookupValue
FunctionManager.resolveLookupValue(lookupTable, value)Finds an id from a lookup value’s label.
Group: Lookups and labels
lookupTable- System table name of the lookup list.
value- Lookup label for resolveLookupValue, or a numeric id string for resolveLookupIdValue.
Returns: The id as a string, or null when no value is resolved.
- Matches the lookup label without case sensitivity.
FunctionManager.resolveLookupValue("contract_statuses", "Active");resolveLookupIdValue
FunctionManager.resolveLookupIdValue(lookupTable, value)Finds a lookup label from its id.
Group: Lookups and labels
lookupTable- System table name of the lookup list.
value- Lookup label for resolveLookupValue, or a numeric id string for resolveLookupIdValue.
Returns: The lookup value’s name, or null when no value is resolved.
- Supply a numeric lookup id as a string.
FunctionManager.resolveLookupIdValue("contract_statuses", "3");convertToDateFormat
FunctionManager.convertToDateFormat(dateIn)Converts recognized date text to a yyyy-MM-dd string.
Group: Dates
dateIn- Date text recognized by the shared date-format detector.
Returns: A date string, or "" after a caught ParseException.
- Supply date text in a recognized date format.
FunctionManager.convertToDateFormat("14/10/2026");formatDate
FunctionManager.formatDate(dateIn, targetFormat)Formats recognized date text with a supplied Java date pattern.
Group: Dates
dateIn- Date text recognized by the shared date-format detector.
targetFormat- Java SimpleDateFormat pattern for the output date.
Returns: The formatted date string, or "" after a caught ParseException.
- Use Java SimpleDateFormat patterns such as dd/MM/yyyy.
FunctionManager.formatDate("2026-10-14", "dd/MM/yyyy");representNumberAsText
FunctionManager.representNumberAsText(numberIn)Writes an integer in English words with capitalized words.
Group: Formatting
numberIn- Numeric input; number-to-words helpers parse integer components.
Returns: An English string.
- Supply an integer as text.
FunctionManager.representNumberAsText("1250");representDecimalAsTextWithCurrency
FunctionManager.representDecimalAsTextWithCurrency(numberIn, currency1, currency2)Writes the whole and fractional digits as English words with supplied unit names.
Group: Formatting
numberIn- Numeric input; number-to-words helpers parse integer components.
currency1- Word for the whole monetary units.
currency2- Word for the fractional monetary units.
Returns: Capitalized money text; "None" for null or empty input.
- Write 2 fractional digits for currency amounts, such as 1250.50.
FunctionManager.representDecimalAsTextWithCurrency("1250.50", "Pounds", "Piastres");convertToMoneyFormat
FunctionManager.convertToMoneyFormat(numberIn)Formats a number with grouping and 2 fractional digits.
Group: Formatting
numberIn- Numeric input; number-to-words helpers parse integer components.
Returns: A formatted string using the configured Locale("en_US").
- Supply numeric text and check the formatted result.
FunctionManager.convertToMoneyFormat("1250.5");bulkCreateRecords
FunctionManager.bulkCreateRecords(targetModuleId, recordList)Sends a Java record list to the create-record request.
Group: Records and writes
targetModuleId- Module id as a string, or its table name. The code accepts both.
recordList- Java ArrayList of RecordModel objects, not a JSON string.
Returns: true on service success (error code 1000), otherwise false.
- Writes records. Check the boolean result.
- Pass actual RecordModel objects in a Java ArrayList, not serialized JSON.
var records = new java.util.ArrayList();
var invoice = FunctionManager.generateRecordTemplate("invoices");
if (invoice != null) {
invoice.getFieldValueMap().get("reference").setCurrentValue("INV-2026-014");
records.add(invoice);
}
records.isEmpty() ? false : FunctionManager.bulkCreateRecords("invoices", records);createRecords
FunctionManager.createRecords(targetModuleId, recordValues)Creates one record from a map of field names to string values.
Group: Records and writes
targetModuleId- Module id as a string, or its table name. The code accepts both.
recordValues- Java HashMap of field system names to string values.
Returns: true on service success (error code 1000), otherwise false.
- Supply known field system names.
- Run record writes from a workflow or an explicit action.
var values = new java.util.HashMap();
values.put("reference", "INV-2026-014");
values.put("amount", "1250.50");
FunctionManager.createRecords("invoices", values);bulkUpdateRecords
FunctionManager.bulkUpdateRecords(targetModuleId, recordList)Sends a Java record list to the update-record request.
Group: Records and writes
targetModuleId- Module id as a string, or its table name. The code accepts both.
recordList- Java ArrayList of RecordModel objects, not a JSON string.
Returns: true on service success (error code 1000), otherwise false.
- Writes records. Keep each record’s identity and check the boolean result.
var records = FunctionManager.loadRecordsByClause("invoices", "WHERE invoices.reference = 'INV-2026-014'");
var changed = false;
if (records != null) {
records.forEach(function (record) { record.getFieldValueMap().get("amount").setCurrentValue("1300.00"); });
changed = FunctionManager.bulkUpdateRecords("invoices", records);
}
changed;generateRecordTemplate
FunctionManager.generateRecordTemplate(targetModuleId)Builds an unsaved record containing the target module’s field definitions.
Group: Records and writes
targetModuleId- Module id as a string, or its table name. The code accepts both.
Returns: A RecordModel, or null when no field set can be loaded.
- Check for null before setting fields.
- Save the prepared record with a create-record helper.
var invoice = FunctionManager.generateRecordTemplate("invoices");
if (invoice != null) { invoice.getFieldValueMap().get("reference").setCurrentValue("INV-2026-014"); }
invoice;copyRecord
FunctionManager.copyRecord(recordModel)Copies the field map into a new unsaved RecordModel.
Group: Records and writes
recordModel- A RecordModel whose field map you want to copy.
Returns: A new RecordModel containing new ModuleFieldModel instances.
- Copies field values into an unsaved record. Set the new record’s values before saving it.
var records = FunctionManager.loadRecordsByClause("invoices", "WHERE invoices.reference = 'INV-2026-014'");
var copy = null;
if (records != null) { copy = FunctionManager.copyRecord(records.get(0)); }
copy;expandUnstructuredToJson
FunctionManager.expandUnstructuredToJson(serlializeFieldObject)Expands the content object of a serialized field into JSON.
Group: Files
serlializeFieldObject- Serialized ModuleFieldModel containing its content metadata.
Returns: JSON text, or "" when parsing yields an empty result.
- Supply a serialized field containing content metadata.
FunctionManager.expandUnstructuredToJson(serializedContractFileField);rebuildUnstructuredObjectFromString
FunctionManager.rebuildUnstructuredObjectFromString(serializedString)Deserializes JSON as an unstructured content model.
Group: Files
serializedString- JSON representation of an UnstructuredModel.
Returns: An UnstructuredModel, or null after a caught IOException.
- Accepts content-model JSON, not the whole serialized field object.
FunctionManager.rebuildUnstructuredObjectFromString(contractFileJson);loadUnstructuredObject
FunctionManager.loadUnstructuredObject(objectKey)Loads the first stored content object matching its object key.
Group: Files
objectKey- Identifier of a stored unstructured file object.
Returns: An UnstructuredModel, or null when no non-empty successful result is available.
- Requires an existing stored object key.
FunctionManager.loadUnstructuredObject(contractFileObjectKey);runAdhocWorkflow
FunctionManager.runAdhocWorkflow(targetModule, moduleKeyFieldValue, workflowId)Starts an adhoc workflow for a record selected by its module key field.
Group: Records and writes
targetModule- Module id as a string, or its table name.
moduleKeyFieldValue- Value of the target module’s key field.
workflowId- Id of the adhoc workflow, as a numeric string.
Returns: A ResponseModel with error code 1000 on the normal success path, or 2056 for explicit failures.
- Use an existing module, its key-field value and an adhoc workflow id.
- Check getErrorCode and getErrorMessage.
var result = FunctionManager.runAdhocWorkflow("purchase_orders", "PO-2026-014", purchaseApprovalWorkflowId);
result.getErrorCode() === 1000;generateUUID
FunctionManager.generateUUID()Generates a UUID through the shared utilities.
Group: Other
Returns: A UUID string.
- Use the UUID as an identifier in your next action.
FunctionManager.generateUUID();What's next
Last checked