Skip to main content

Function JSS

addApplUserParameter​

Adds one or more application-level user parameters for a specific user. Creates Prm40ApplUserPar records associated with the current application.

Syntax

//return ListResponse type
var risp = utils.addApplUserParameter(
companyId, //String
siteId, //Long
userCodeId, //String
parameters //Map[]
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
userCodeIdStringthe user code to associate parameters with
parametersMap[]an array of Maps, each representing a parameter to add. Expected keys: (details below)

parameters​

an array of Maps, each representing a parameter to add. Expected keys:

  • "codeId" (String) — the parameter code identifier (required)
  • "value" (String) — the parameter value (required)
  • "description" (String) — an optional description for the parameter
  • "note" (String) — an optional note for the parameter

✅ Returns

a ListResponse containing the inserted Prm40ApplUserPar records, or null if an error occurs

⚠️ Throws

  • Throwable if a server communication error occurs

addAttribute​

Add an attribute (e.g. "member of") to the entry identified by "filterDN".

Syntax

//return int type
var risp = utils.addAttribute(
host, //String
port, //Integer
filterDN, //String
ldapUsername, //String
ldapPassword, //String
attributeNameToAdd, //String
attributeValueToAdd //String
);

Details

ArgumentTypeDescription
hostStringLDAP host
portIntegerLDAP port (optional: if not specified, 389 will be used)
filterDNStringbase DN to apply as a filter
ldapUsernameStringusername to use to authenticate to the LDAP server
ldapPasswordStringpassword to use to authenticate to the LDAP server
attributeNameToAddStringattribute name to add to every entry matching the search criteria
attributeValueToAddStringattribute value to add to every LDAP entry matching the search criteria.

✅ Returns

attributeValueToAdd attribute value to add to every entry matching the search criteria


addBackgroundToPdf2​

Placeholder method for adding a watermark/background text to an existing PDF document. Note: This method is currently a no-op (implementation is commented out). Use String, String, Map) instead for a working implementation.

Syntax

utils.addBackgroundToPdf2(
dirId, //Long
pdfFile, //String
background //String
);

Details

ArgumentTypeDescription
dirIdLongthe platform directory ID containing the PDF file
pdfFileStringthe PDF file name (relative to the directory path)
backgroundStringthe watermark text to overlay on each page

⚠️ Throws

  • Throwable if loading the PDF file fails

addBackgroundToPdf​

Adds a semi-transparent watermark text as a foreground overlay to every page of an existing PDF document. The watermark is centered horizontally and vertically on the page. The font size is auto-calculated based on page width and text length, unless explicitly set in the settings map. The resulting document is saved to the same or a different file depending on the "fileName" setting.

Syntax

utils.addBackgroundToPdf(
dirId, //Long
pdfFile, //String
background, //String
settings //Map
);

Details

ArgumentTypeDescription
dirIdLongthe platform directory ID containing the PDF file, resolved via getDirectoryPath()
pdfFileStringthe PDF file name (relative to the directory path)
backgroundStringthe watermark/overlay text to render on each page
settingsMapoptional configuration map. Supported keys: (details below)

settings​

optional configuration map. Supported keys:

  • "red" (Number) — red component of text color, 0-255 (default: 200)
  • "green" (Number) — green component of text color, 0-255 (default: 200)
  • "blue" (Number) — blue component of text color, 0-255 (default: 200)
  • "fontName" (String) — font for the watermark text (default: "Helvetica-Bold"). Allowed values: "Courier", "Courier-Bold", "Courier-BoldOblique", "Courier-Oblique", "Helvetica", "Helvetica-Bold", "Helvetica-BoldOblique", "Helvetica-Oblique", "Symbol", "Times-Bold", "Times-BoldItalic", "Times-Italic", "Times-Roman", "ZapfDingbats"
  • "fontSize" (Number) — font size in points (default: pageWidth / text length)
  • "fileName" (String) — output file name for the watermarked PDF (default: same as input pdfFile, overwriting it)

⚠️ Throws

  • Throwable if the PDF file cannot be loaded, overlay creation fails, or saving fails

addBarcodeToPDFFile​

Adds a barcode image to the current page of an already opened PDF file at the specified coordinates. The barcode is rendered as a bitmap image (converted to JPEG internally) and drawn onto the PDF page. If no page has been added yet, one is created automatically via addPageToPDFFile.

Syntax

utils.addBarcodeToPDFFile(
uuid, //String
x, //int
y, //int
barcodeString, //String
barcodeType, //String
settings //Map
);

Details

ArgumentTypeDescription
uuidStringthe output stream identifier returned by Long, Map)
xintX coordinate in points (from left to right) where the barcode will be placed
yintY coordinate in points (from bottom to top) where the barcode will be placed
barcodeStringStringthe data/text to encode in the barcode
barcodeTypeStringthe barcode symbology. Supported values (case-insensitive): "Code128", "Code39", "Interleaved2Of5", "Ean8", "Upca", "pdf417"
settingsMapconfiguration map for barcode rendering. Supported keys: (details below)

settings​

configuration map for barcode rendering. Supported keys:

  • "dpi" (Number) — resolution in dots per inch for barcode rendering (default: 150)
  • "fontName" (String) — font name for the human-readable text below/above the barcode
  • "fontSize" (Number) — font size for the human-readable text
  • "textPosition" (String) — position of human-readable text. Allowed values: "NONE" (no text), "TOP", "BOTTOM"
  • "width" (Number) — forced width in points for the barcode image on the PDF (default: actual barcode bitmap width)
  • "height" (Number) — forced height in points for the barcode image on the PDF (default: actual barcode bitmap height)

⚠️ Throws

  • Throwable if barcode generation or PDF writing fails
  • RuntimeException if the PDF file has not been opened (uuid not found), or if an unsupported barcode type is specified

addCompanyRelation​

Adds one or more subject relations for a user within a company. Looks up the user by company/site/userCode, then creates Sub38SubRelation entries linking the user's subject to the specified company subject with the given relation types.

Syntax

//return ListResponse type
var risp = utils.addCompanyRelation(
companyId, //String
siteId, //Long
companySubjectId, //String
userCodeId, //String
relations //Map[]
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
companySubjectIdStringthe parent subject identifier (company subject) to relate to
userCodeIdStringthe user code (will be uppercased) whose subject is being related
relationsMap[]an array of Maps, each representing a relation to add. Expected keys: (details below)

relations​

an array of Maps, each representing a relation to add. Expected keys:

  • "relationSubId" (String) — the relation sub-type identifier (SUB39)

✅ Returns

a ListResponse containing the inserted Sub38SubRelation records, or null if an error occurs

⚠️ Throws

  • Throwable if a server communication error occurs

addCustomApplUserVarsWithTimeout​

Add a custom parameter to the user session.

Syntax

utils.addCustomApplUserVarsWithTimeout(
code, //String
value, //String
seconds //Long
);

Details

ArgumentTypeDescription
codeStringcustom session-variable key to create or overwrite.
valueStringvalue to associate with the custom session-variable key.
secondsLonglifetime in seconds after which the custom variable expires automatically.

addCustomApplUserVars​

Add a custom parameter to the user session.

Syntax

utils.addCustomApplUserVars(
code, //String
value //String
);

Details

ArgumentTypeDescription
codeStringcustom session-variable key to create or overwrite.
valueStringvalue to associate with the custom session-variable key.

addDate​

Adds (or subtracts) a given time interval to a date expressed in milliseconds.

Syntax

//return Date type
var risp = utils.addDate(
currentTimeMillis, //Long
field, //String
amount //Number
);

Details

ArgumentTypeDescription
currentTimeMillisLongthe starting date expressed as a timestamp in milliseconds (epoch)
fieldStringthe time field to operate on; allowed values: "DAY", "MONTH", "YEAR", "HOUR", "MINUTE", "SECOND", "MILLISECOND"
amountNumberthe amount to add (positive) or subtract (negative)

✅ Returns

the new date resulting from the operation

⚠️ Throws

  • Throwable in case of errors

addDate​

Adds (or subtracts) a given time interval to a date expressed in milliseconds.

Syntax

//return Date type
var risp = utils.addDate(
field, //String
amount //Number
);

Details

ArgumentTypeDescription
fieldStringthe time field to operate on; allowed values: "DAY", "MONTH", "YEAR", "HOUR", "MINUTE", "SECOND", "MILLISECOND"
amountNumberthe amount to add (positive) or subtract (negative)

✅ Returns

the new date resulting from the operation

⚠️ Throws

  • Throwable in case of errors

addDate​

Adds (or subtracts) a given time interval to a date expressed in milliseconds.

Syntax

//return Date type
var risp = utils.addDate(
date, //String
format, //String
field, //String
amount //Number
);

Details

ArgumentTypeDescription
dateStringthe starting date expressed as a string
formatStringthe format of the input string (e.g. "yyyy-MM-dd'T'HH:mm:ss"); if null the default ISO format is used
fieldStringthe time field to operate on; allowed values: "DAY", "MONTH", "YEAR", "HOUR", "MINUTE", "SECOND", "MILLISECOND"
amountNumberthe amount to add (positive) or subtract (negative)

✅ Returns

the new date resulting from the operation

⚠️ Throws

  • Throwable in case of errors

addImageToPDFFile​

Adds an image from a local file to the current page of an already opened PDF file at the specified coordinates. Supported image formats: PNG, JPG/JPEG, and TIF/TIFF. If no page has been added yet, one is created automatically via addPageToPDFFile. For PNG files, the image is internally converted to JPEG (via a temporary file) before embedding.

Syntax

utils.addImageToPDFFile(
uuid, //String
x, //int
y, //int
imgPath, //String
width, //int
height //int
);

Details

ArgumentTypeDescription
uuidStringthe output stream identifier returned by Long, Map)
xintX coordinate in points (from left to right) where the image will be placed
yintY coordinate in points (from bottom to top) where the image will be placed
imgPathStringabsolute path to the image file on the server file system
widthintdesired width in points for the image on the PDF page
heightintdesired height in points for the image on the PDF page

⚠️ Throws

  • Throwable if the image cannot be read or PDF writing fails
  • RuntimeException if the PDF file has not been opened (uuid not found), or if the image format is not supported (not png/jpg/jpeg/tif/tiff)

addLineToPDFFile​

Adds a line of text to the current page of an already opened PDF file using sequential layout. Text is placed at the current cursor position (left margin, current Y position) and the cursor advances downward by the configured line height. When the cursor reaches the bottom margin, a new page is automatically created. If no page has been added yet, one is created automatically via addPageToPDFFile.

Syntax

utils.addLineToPDFFile(
uuid, //String
line, //String
settings //Map
);

Details

ArgumentTypeDescription
uuidStringthe output stream identifier returned by Long, Map)
lineStringthe text content to write on the current line
settingsMapcurrently unused by this method (reserved for future extensions); font and layout settings are taken from the Map passed to Long, Map)

⚠️ Throws

  • Throwable if writing to the PDF fails
  • RuntimeException if the PDF file has not been opened (uuid not found)

addMembersToChatGroup​

Adds members to an existing chat group. Retrieves the current group from the server, appends new members (avoiding duplicates), and saves the updated group via the ChatManager singleton.

Syntax

utils.addMembersToChatGroup(
groupId, //String
myPhoneNumber, //String
contactNames, //String>
contactPhoneNumbers //String>
);

Details

ArgumentTypeDescription
groupIdStringthe unique identifier of the chat group
myPhoneNumberStringthe phone number of the current user (used for logging)
contactNamesString>list of display names for the contacts to add
contactPhoneNumbersString>list of phone numbers for the contacts to add (parallel to contactNames)

⚠️ Throws

  • Throwable in case of server communication errors

addPageToPDFFile​

Adds a new page to an already opened PDF file and sets it as the current page for content writing. Applies the page size, orientation, margins, and font settings from the settings Map originally passed to Long, Map). A new PDPageContentStream is opened for the page. The previous content stream (if any) is closed. Every 50 pages, an incremental save is performed to flush content to disk and free memory.

Syntax

utils.addPageToPDFFile(
uuid //String
);

Details

ArgumentTypeDescription
uuidStringthe output stream identifier returned by Long, Map)

⚠️ Throws

  • Throwable if writing to the PDF fails
  • RuntimeException if the PDF file has not been opened (uuid not found)

addResponseHeader​

Add an HTTP response header to the web service response.

Syntax

utils.addResponseHeader(
headerName, //String
headerValue //String
);

Details

ArgumentTypeDescription
headerNameStringheader name
headerValueStringheader value

addSessionAttribute​

Add an HTTP response header to the web service response.

Syntax

utils.addSessionAttribute(
attrinuteName, //String
value //String
);

Details

ArgumentTypeDescription
attrinuteNameStringname of the session attribute to add to the current web-service response context.
valueStringvalue to store for the specified session attribute.

addUserRoleForApplication​

Adds one or more roles to an existing user for a specific application (not necessarily the current one).

Syntax

//return Prm01User type
var risp = utils.addUserRoleForApplication(
appId, //String
companyId, //String
siteId, //Long
userCodeId, //String
roles //Map[]
);

Details

ArgumentTypeDescription
appIdStringthe target application identifier
companyIdStringthe company identifier
siteIdLongthe site identifier
userCodeIdStringthe user code identifier (will be converted to uppercase)
rolesMap[]an array of Maps defining roles to assign. Each Map must contain: (details below)

roles​

an array of Maps defining roles to assign. Each Map must contain:

  • "roleId" (String) — the role identifier
  • "siteId" (Number) — the site ID for the role
  • "startDate" (java.util.Date) — role validity start date
  • "endDate" (java.util.Date, optional) — role validity end date

✅ Returns

the Prm01User object if roles were added successfully, or null on error

⚠️ Throws

  • Throwable in case of errors

addUserRole​

Adds one or more roles to an existing user for the current application. Retrieves the user's existing roles and appends the new ones without removing any.

Syntax

//return Prm01User type
var risp = utils.addUserRole(
companyId, //String
siteId, //Long
userCodeId, //String
roles //Map[]
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
userCodeIdStringthe user code identifier (will be converted to uppercase)
rolesMap[]an array of Maps defining roles to assign. Each Map must contain: (details below)

roles​

an array of Maps defining roles to assign. Each Map must contain:

  • "roleId" (String) — the role identifier
  • "siteId" (Number) — the site ID for the role
  • "startDate" (java.util.Date) — role validity start date
  • "endDate" (java.util.Date, optional) — role validity end date

✅ Returns

the Prm01User object if roles were added successfully, or null on error

⚠️ Throws

  • Throwable in case of errors

applicationExportBackup​

Performs a full application export backup, including metadata and context files. The backup can be stored either locally (in the specified directory) or remotely (via FTP). Optionally manages backup rotation by deleting older backups beyond the specified threshold.

Syntax

//return boolean type
var risp = utils.applicationExportBackup(
toDirId, //Long
ftpHost, //String
ftpPort, //Long
ftpUseSSL, //String
ftpUsername, //String
ftpPassword, //String
ftpDestination, //String
availbaleBackup //Long
);

Details

ArgumentTypeDescription
toDirIdLongdirectory identifier for local backup storage
ftpHostString(optional) FTP server host; if empty, backup is stored locally
ftpPortLong(optional) FTP server port
ftpUseSSLString(optional) "Y" to use SSL for FTP connection
ftpUsernameString(optional) FTP username
ftpPasswordString(optional) FTP password
ftpDestinationString(optional) FTP destination folder
availbaleBackupLong(optional) maximum number of backup files to retain; older ones are deleted

✅ Returns

true if the export completed successfully, false otherwise

⚠️ Throws

  • Throwable in case of errors

applicationMetadataImport​

Imports application metadata from an XML file stored in the specified directory. Validates the XML against the platform XSD schema before importing.

Syntax

//return boolean type
var risp = utils.applicationMetadataImport(
fromDirId, //Long
fileName //String
);

Details

ArgumentTypeDescription
fromDirIdLongdirectory identifier where the XML metadata file is located
fileNameStringname of the XML file to import

✅ Returns

true if the import was completed successfully

⚠️ Throws

  • Throwable in case of validation, I/O, or server communication errors

backupDirFiles​

Performs a backup of all files in a directory, compressing them into ZIP archives and optionally uploading them to an FTP server. Manages backup rotation by removing old archives.

Syntax

//return boolean type
var risp = utils.backupDirFiles(
baseDirId, //Long
toDirId, //Long
ftpHost, //String
ftpPort, //Long
ftpUseSSL, //String
ftpUsername, //String
ftpPassword, //String
ftpDestination, //String
suffixZipFile, //String
availbaleBackup //Long
);

Details

ArgumentTypeDescription
baseDirIdLongsource directory identifier containing files to backup
toDirIdLongdestination directory identifier for local backup storage
ftpHostString(optional) FTP server host; if empty/null, backup is stored locally
ftpPortLong(optional) FTP server port
ftpUseSSLString(optional) "Y" to use SSL for FTP connection
ftpUsernameString(optional) FTP username
ftpPasswordString(optional) FTP password
ftpDestinationString(optional) FTP destination folder
suffixZipFileString(optional) prefix/suffix to add to generated ZIP file names
availbaleBackupLong(optional) maximum number of backup files to retain; older ones are deleted

✅ Returns

true if the backup was completed successfully, false on error


blockingWaitAllElements​

BLOCKING Wait for termination of all elements enqueued and identified by the specified element ids.

Syntax

//return String type
var risp = utils.blockingWaitAllElements(
timeout, //Long
elementIdsStr //String[]
);

Details

ArgumentTypeDescription
timeoutLongmax waiting secs before interrupting method and get a transaction id back
elementIdsStrString[]queue element identifiers to wait for, expressed as strings.

callBusinessComponent​

Invoke a business component by its component ID, executing it as if it were called via HTTP request. The business component can fill in either a grid or a form panel. All request parameters from the current server-side JS business component are forwarded automatically.

Syntax

//return String type
var risp = utils.callBusinessComponent(
compId, //Long
additionalReqParams, //Map
decodedReqParams, //Map
decodedFilterNames //Map
);

Details

ArgumentTypeDescription
compIdLongthe business component ID to invoke
additionalReqParamsMap(optional: can be null); a Map<String, String> of additional request parameters to inject. Keys are parameter names, values are parameter values. These supplement (and override) the parameters from the original HTTP request. Common keys include any parameter expected by the target business component (e.g. filter values, pagination parameters like "startPos", "blockSize")
decodedReqParamsMap(optional: can be null); a Map<String, String> used to rename request parameter names. Keys are the original parameter names as requested by the business component; values are the replacement parameter names to look up from the original request. This allows mapping parameters from one context to another without changing the source
decodedFilterNamesMap(optional: can be null); a Map<String, String> used to rename filter/sort field names. Keys are the original field names found in "quickFilterNames", "filterNames", or "sort" request parameters; values are replacement field names. This is useful when the target business component uses different column names than those expected by the calling context

✅ Returns

the JSON response string produced by the business component execution

⚠️ Throws

  • Throwable if the business component execution fails

camelToSnake​

Converts a camelCase or mixed-case string to snake_case format.

Syntax

//return String type
var risp = utils.camelToSnake(
str, //String
toUpperCase //boolean
);

Details

ArgumentTypeDescription
strStringthe text to convert (e.g., "abcDEF")
toUpperCasebooleantrue to produce uppercase snake_case (e.g., "ABC_DEF"), false for lowercase (e.g., "abc_d_e_f")

✅ Returns

the converted snake_case string


camel​

Convert a table.field name to an attribute name, using the camel format. Example: TAB.FIELD_NAME -> fieldName

Syntax

//return String type
var risp = utils.camel(
fieldName, //String
firstCharUpper //Boolean
);

Details

ArgumentTypeDescription
fieldNameStringtable.fieldname
firstCharUpperBooleanflag used to define if the first letter of the converted string must be set as uppercase

✅ Returns

attribute name representation of the specified database field name


checkCellsWithMetadataForImport​

Validates that the Excel cells referenced by a Value Import configuration contain valid metadata. Checks whether the cell coordinates defined in the import mapping actually exist and are accessible in the specified Excel file.

Syntax

//return String type
var risp = utils.checkCellsWithMetadataForImport(
directoryId, //Long
fileName, //String
valueImportId //Long
);

Details

ArgumentTypeDescription
directoryIdLongthe platform directory identifier where the Excel file is located
fileNameStringthe name of the Excel file to check
valueImportIdLongthe Value Import configuration identifier whose cell mappings are to be validated

✅ Returns

a JSON string with structure \{ "success": true/false, "errors": [...] }; when success is false, the errors array contains objects describing each validation failure

⚠️ Throws

  • Throwable if a server error occurs during validation

checkFunctionId​

This method will fire an exception in case the specified functionName is not enabled for the current logged user.

Syntax

utils.checkFunctionId(
functionId //String
);

Details

ArgumentTypeDescription
functionIdStringfunction name to check out

checkRoleId​

This method will fire an exception in case the specified role id is not bounded for the current logged user.

Syntax

utils.checkRoleId(
roleId //String
);

Details

ArgumentTypeDescription
roleIdStringrole id to check out

clearWritingCache​

Clears the server-side writing cache for a specific table on the given datasource. This forces subsequent write operations to bypass any cached metadata for the specified table.

Syntax

utils.clearWritingCache(
datasourceId, //Long
table //String
);

Details

ArgumentTypeDescription
datasourceIdLongthe platform datasource identifier
tableStringthe table name whose writing cache should be invalidated

closeCSVFile​

Close a CSV file, previously opened.

Syntax

utils.closeCSVFile(
uuid //String
);

Details

ArgumentTypeDescription
uuidStringoutput stream identifier, related to a CSV file already opended; this id is returned by the "openCSVFile" method

⚠️ Throws

  • Throwable in case the CSV file has not been opened or has already closed

closePDFFile​

Closes a previously opened PDF file, flushing all remaining content to disk. This is the final step in the PDF generation lifecycle: the content stream is closed, the document is saved (incrementally if in overwrite mode, full save otherwise), and the internal descriptor is removed from the tracking map. After this method is called, the uuid is no longer valid for any PDF operations.

Syntax

utils.closePDFFile(
uuid //String
);

Details

ArgumentTypeDescription
uuidStringthe output stream identifier returned by Long, Map)

⚠️ Throws

  • Throwable if closing or saving the document fails
  • RuntimeException if the PDF file has not been opened (uuid not found)

closeTextFile​

Close a text file, previously opened.

Syntax

utils.closeTextFile(
uuid //String
);

Details

ArgumentTypeDescription
uuidStringoutput stream identifier, related to a text file already opened; this id is returned by the "openTextFile" method

⚠️ Throws

  • Throwable in case the text file has not been opened or has already closed

convertDateToSqlDate​

Converts a Date to a Date.

Syntax

//return Date type
var risp = utils.convertDateToSqlDate(
date //Date
);

Details

ArgumentTypeDescription
dateDatethe date to convert

✅ Returns

the equivalent Date


convertDateToString​

Converts a Date to its string representation using the specified format. If format is null, the ISO format "yyyy-MM-dd'T'HH:mm:ss" is used.

Syntax

//return String type
var risp = utils.convertDateToString(
date, //Date
format //String
);

Details

ArgumentTypeDescription
dateDatethe date to convert
formatStringthe output format pattern (e.g. "dd/MM/yyyy"); if null, ISO format is used

✅ Returns

the formatted date string


convertDateToString​

Converts a Date to its string representation using the specified format. If format is null, the ISO format "yyyy-MM-dd'T'HH:mm:ss" is used.

Syntax

//return Map type
var risp = utils.convertDateToString(
vo //Map
);

Details

ArgumentTypeDescription
voMapa Map potentially containing NativeDate objects as values; may be null

✅ Returns

the formatted date string


convertDateToTimestamp​

Converts a Date to a Timestamp.

Syntax

//return Timestamp type
var risp = utils.convertDateToTimestamp(
date //Date
);

Details

ArgumentTypeDescription
dateDatethe date to convert

✅ Returns

the equivalent Timestamp


convertSecondToHoursMinutesSeconds​

Converts a number of seconds into a formatted time string "HH:MM:SS".

Syntax

//return String type
var risp = utils.convertSecondToHoursMinutesSeconds(
seconds //Long
);

Details

ArgumentTypeDescription
secondsLongthe total number of seconds to convert

✅ Returns

the formatted time string (e.g. "01:30:45")


convertStringToDate​

Converts a string representing a date in the specified format to a Date object. Internally delegates to String, String, Number) adding 0 days.

Syntax

//return Date type
var risp = utils.convertStringToDate(
dateAsString, //String
format //String
);

Details

ArgumentTypeDescription
dateAsStringStringthe string representing the date
formatStringthe format of the string (e.g. "yyyy-MM-dd", "dd/MM/yyyy HH:mm:ss")

✅ Returns

the Date object resulting from parsing

⚠️ Throws

  • Throwable in case of parsing errors

convertStringToNumber​

Convert a string representing a number to a number.

Syntax

//return Number type
var risp = utils.convertStringToNumber(
number //String
);

Details

ArgumentTypeDescription
numberStringthe string must have the righr format: int.dec No grouping symbols are allowed and the decimal symbol, if included, must be the period .

✅ Returns

converted number

⚠️ Throws

  • Exception in case the input string is not a number or a number expressed with the right format

convertStringToUTCDate​

Converts a date string to a Date in UTC timezone. Uses the format "yyyy-MM-dd HH:mm:ss".

Syntax

//return Date type
var risp = utils.convertStringToUTCDate(
date //String
);

Details

ArgumentTypeDescription
dateStringthe date string to parse (e.g. "2024-01-15 10:30:00")

✅ Returns

the parsed Date object in UTC timezone

⚠️ Throws

  • Throwable in case of parsing errors

convertUTCStringToDate​

Converts a UTC date string to a Date object. Automatically detects whether the separator between date and time is 'T' or a space. If the string is longer than 19 characters, it is truncated to the first 19 characters. The parsing is performed using UTC timezone.

Syntax

//return Date type
var risp = utils.convertUTCStringToDate(
utcDateAsString //String
);

Details

ArgumentTypeDescription
utcDateAsStringStringa date string in UTC format (e.g. "2024-01-15 10:30:00" or "2024-01-15T10:30:00")

✅ Returns

the parsed Date in UTC timezone

⚠️ Throws

  • Throwable in case of parsing errors

convertUTCStringToTimeZoneDate​

Converts a UTC date string to a Date adjusted by the specified timezone offset.

Syntax

//return Date type
var risp = utils.convertUTCStringToTimeZoneDate(
utcDateAsString, //String
hrs //int
);

Details

ArgumentTypeDescription
utcDateAsStringStringa date string in UTC format (e.g. "2024-01-15T10:30:00")
hrsinttimezone offset in hours to add to the UTC date (note: internally multiplied by 86400000ms, so this effectively adds days, not hours — likely a design quirk)

✅ Returns

the adjusted Date

⚠️ Throws

  • Throwable in case of parsing errors

convertXMLToHTML​

Convert the specified XML file to HTML, using the specified XSD document to apply the XSLT transformation.

Syntax

//return boolean type
var risp = utils.convertXMLToHTML(
xmlDirId, //Long
xmlFileName, //String
xslDirId, //Long
xslFileName, //String
htmlDirId, //Long
htmlFileName, //String
namespaceAware, //Boolean
validating //Boolean
);

Details

ArgumentTypeDescription
xmlDirIdLongdirectory id where the XML data file is located
xmlFileNameStringXML data file
xslDirIdLongdirectory id where the XSL data file is located
xslFileNameStringXSL stylesheet file
htmlDirIdLongdirectory id where the HTML file to generate will be saved
htmlFileNameStringHTML file to generate
namespaceAwareBooleantrue to create a namespace-aware XML parser before applying the XSL transformation.
validatingBooleantrue to enable XML validation in the parser before transformation.

copyCompanyId​

Duplicates a company by creating a new company ID based on an existing one. Reads SQL statements from the file auth4ws_new_company.sql and executes them to replicate the company data. The new corporate name is set to "-".

Syntax

//return boolean type
var risp = utils.copyCompanyId(
startingCompanyId, //String
newCompanyId, //String
newCorporateName //String
);

Details

ArgumentTypeDescription
startingCompanyIdStringthe source company ID to duplicate
newCompanyIdStringthe new company ID value
newCorporateNameStringthe corporate name for the new company

✅ Returns

true if the duplication completed successfully, false otherwise


copyCompanyId [Deprecated]​

Duplicates a company by creating a new company ID based on an existing one. Reads SQL statements from the file auth4ws_new_company.sql and executes them to replicate the company data. The new corporate name is set to "-".

Syntax

//return boolean type
var risp = utils.copyCompanyId(
startingCompanyId, //String
newCompanyId //String
);

Details

ArgumentTypeDescription
startingCompanyIdStringthe source company ID to duplicate
newCompanyIdStringthe new company ID value

✅ Returns

true if the duplication completed successfully, false otherwise


copyDataFromBorderTable​

Copy data from a border table to a final table, where all FKs have been already set in the border table. It is possible either to INSERT all input records or UPDATE them. Update is possible only if the PKs for the final table are already available in the border table. In case of insert, he PK can be either input fields or a UUID calculated on the fly or a counter reckoned thorugh a counter table. In the latter case, records in the counter table must be already defined in the PROG_ID table used to calculate the next counter

Syntax

//return Long type
var risp = utils.copyDataFromBorderTable(
settings //Map
);

Details

ArgumentTypeDescription
settingsMap{ srcDatasourceId: [Long] datasource id of from table fromTable: [String] name of origin table fromTableFilter: [String] fromFK: [String] fromLoadedFieldName: [String] errorFieldName: [String] containsErrorsField: [String] operation: [String] (default "INSERT") defaultFields: [Map] defaultInLineFields: [Map] mappingFields: [Map] destDatasourceId: [Long] datasource id of to table toTable: [String] name of destination table toTableFilter: [String] filter used to check if a SINGLE record exists in a destination table idAsNum: [String] idAsUuid: [String] progIdValueField: [String] progIdTable: [String] progIdIncField: [String] progIdWhere: [String] commitSize: [Long] (default 1000) }

✅ Returns

in case of error return a number of errors, else the total number of record elaborated

⚠️ Throws

  • Throwable

copyFile​

Copy the source file to the destination file. Since "destFile" contains a file name too, the source file can be renamed when copied.

Syntax

//return boolean type
var risp = utils.copyFile(
srcFile, //String
destFile, //String
replaceExistingFile, //Boolean
deleteSourceFile //Boolean
);

Details

ArgumentTypeDescription
srcFileStringabsolute path + file name
destFileStringabsolute file + file name
replaceExistingFileBooleanflag used to replace an already existing destination file; if false and the destination exists, the copy is aborted.
deleteSourceFileBooleanflag used to delete the source file, once the file has been copied to the destination path

✅ Returns

true if the file has been copied successfully, false otherwise

⚠️ Throws

  • Throwable in case of errors

copyFile​

Copy the source file to the destination file. Since "destFile" contains a file name too, the source file can be renamed when copied.

Syntax

utils.copyFile(
inBaseDir, //String
inFileName, //String
destPathFileName //String
);

Details

ArgumentTypeDescription
inBaseDirStringbase dir where the file is stored (not required in case of GFS)
inFileNameStringfile name (uuid in case of GFS)
destPathFileNameStringabsolute path + file name where the source file must be copied

✅ Returns

true if the file has been copied successfully, false otherwise

⚠️ Throws

  • Throwable in case of errors

copyImportRowsFromFile​

Duplicate an already existing import data in table configuration, starting from its import id.

Syntax

//return Long type
var risp = utils.copyImportRowsFromFile(
importId, //Long
newDescription //String
);

Details

ArgumentTypeDescription
importIdLongalready existing import data definition to duplicate
newDescriptionStringnew description for the duplicated import

✅ Returns

a new import id

⚠️ Throws

  • Throwable in case of errors (e.g. the passed import id does not exist)

countRowsOfCSVFile​

Counts the total number of rows in a CSV file. This is an alias for countRowsOfTextFile since CSV files are text files.

Syntax

//return Long type
var risp = utils.countRowsOfCSVFile(
filePath //String
);

Details

ArgumentTypeDescription
filePathStringthe absolute path to the CSV file

✅ Returns

the number of lines in the file

⚠️ Throws

  • Throwable if the file cannot be read or does not exist

countRowsOfTextFile​

Counts the total number of lines in a text file using a buffered reader stream.

Syntax

//return Long type
var risp = utils.countRowsOfTextFile(
filePath //String
);

Details

ArgumentTypeDescription
filePathStringthe absolute path to the text file

✅ Returns

the number of lines in the file

⚠️ Throws

  • Throwable if the file cannot be read or does not exist

createAllowedLinkWithRtk​

Creates a token to use when invoking a server-side JavaScript action, including an RTK (encoded credentials). This is a convenience overload that delegates to Long, String, String) with no note.

Syntax

//return String type
var risp = utils.createAllowedLinkWithRtk(
expirationDays, //Long
maxTimes, //Long
rtk //String
);

Details

ArgumentTypeDescription
expirationDaysLongnumber of days after which this token expires; 0 or null for no expiration
maxTimesLongmaximum number of times this token can be used before expiring
rtkStringBase64-encoded string containing companyId, siteId, username, and password

✅ Returns

the generated token string

⚠️ Throws

  • Throwable if a server communication error occurs

Creates a token to use when invoking a server-side JavaScript action without authentication. This is a convenience overload that delegates to Long, String, String) with no RTK and no note.

Syntax

//return String type
var risp = utils.createAllowedLink(
expirationDays, //Long
maxTimes, //Long
rtk, //String
note //String
);

Details

ArgumentTypeDescription
expirationDaysLongnumber of days after which this token expires; 0 or null for no expiration
maxTimesLongmaximum number of times this token can be used before expiring
rtkStringcompanyId, siteId, username and password in base64
noteStringdescription of token

✅ Returns

the generated token string

⚠️ Throws

  • Throwable if a server communication error occurs

Creates a token to use when invoking a server-side JavaScript action without authentication. This is a convenience overload that delegates to Long, String, String) with no RTK and no note.

Syntax

//return String type
var risp = utils.createAllowedLink(
expirationDays, //Long
maxTimes //Long
);

Details

ArgumentTypeDescription
expirationDaysLongnumber of days after which this token expires; 0 or null for no expiration
maxTimesLongmaximum number of times this token can be used before expiring

✅ Returns

the generated token string

⚠️ Throws

  • Throwable if a server communication error occurs

createAllowedUrl​

Create a link to include for instance in an email, with the autologin and parameters, in order to invoke a JS server-side action.

Syntax

//return String type
var risp = utils.createAllowedUrl(
baseUrl, //String
actionId, //Long
aName, //String
aValue, //String
rName, //String
rValue, //String
params, //String
expirationDays, //Long
maxTimes, //Long
message //String
);

Details

ArgumentTypeDescription
baseUrlStringe.g. http://host:port/platform/
actionIdLongidentifier of the server-side JavaScript action that the generated allowed URL must invoke.
aNameStringquery-string parameter name used by approve.jsp to carry the positive/accept value.
aValueStringquery-string value paired with aName for the positive/accept branch.
rNameStringquery-string parameter name used by approve.jsp to carry the reject/alternative value.
rValueStringquery-string value paired with rName for the reject/alternative branch.
paramsStringadditional query-string fragment to append to the generated URL, already formatted as name=value pairs joined by &.
expirationDaysLongnumber of days after which the generated auth token expires; values less than or equal to zero mean no expiration.
maxTimesLongmaximum number of times the generated link/token can be used.
messageStringmessage text appended to the generated approve.jsp URL and typically shown to the user.

✅ Returns

URL composed of the base url + the additional part which allows to invoke and access a server-side js action


createCSVFileFromSQLQuery​

Creates a CSV file from the result of a SQL query. This is a convenience overload that delegates to the full version with charset set to null.

Syntax

//return String type
var risp = utils.createCSVFileFromSQLQuery(
fileName, //String
overwrite, //Boolean
directoryId, //Long
sep, //String
languageId, //String
printTitles, //Boolean
fileAppend, //Boolean
formatColumns, //String[]
datasourceId, //Long
sqlQuery, //String
pars //Object[]
);

Details

ArgumentTypeDescription
fileNameStringCSV file name to create
overwriteBooleanif true, overwrites the file if it already exists
directoryIdLongdirectory identifier where the CSV file will be stored
sepStringcolumn separator character (e.g. ";" or ",")
languageIdStringlanguage ID used for formatting numbers/dates
printTitlesBooleanif true, prints column headers as the first row
fileAppendBooleanif true, appends content to an existing file
formatColumnsString[]array of format patterns for each column (e.g. "0.00" for decimals); can be null
datasourceIdLongoptional data source identifier; if null, the default is used
sqlQueryStringthe SQL SELECT query to execute
parsObject[]bind variable values for the SQL query placeholders (?)

✅ Returns

an error message in case of errors, or empty string if the CSV file was created successfully

⚠️ Throws

  • Throwable in case of errors

createCSVFileFromSQLQuery​

Creates a CSV file from the result of a SQL query. This is a convenience overload that delegates to the full version with charset set to null.

Syntax

//return String type
var risp = utils.createCSVFileFromSQLQuery(
fileName, //String
overwrite, //Boolean
directoryId, //Long
sep, //String
languageId, //String
printTitles, //Boolean
fileAppend, //Boolean
charset, //String
formatColumns, //String[]
datasourceId, //Long
sqlQuery, //String
pars //Object[]
);

Details

ArgumentTypeDescription
fileNameStringCSV file name to create
overwriteBooleanif true, overwrites the file if it already exists
directoryIdLongdirectory identifier where the CSV file will be stored
sepStringcolumn separator character (e.g. ";" or ",")
languageIdStringlanguage ID used for formatting numbers/dates
printTitlesBooleanif true, prints column headers as the first row
fileAppendBooleanif true, appends content to an existing file
charsetString(optional) character encoding for the output file (e.g. "UTF-8"); if null, default encoding is used
formatColumnsString[]array of format patterns for each column (e.g. "0.00" for decimals); can be null
datasourceIdLongoptional data source identifier; if null, the default is used
sqlQueryStringthe SQL SELECT query to execute
parsObject[]bind variable values for the SQL query placeholders (?)

✅ Returns

an error message in case of errors, or empty string if the CSV file was created successfully

⚠️ Throws

  • Throwable in case of errors

createCSVFile​

Create a csv file

Syntax

//return String type
var risp = utils.createCSVFile(
fileName, //String
overwrite, //Boolean
directoryId, //Long
data, //List
sep, //String
languageId, //String
exportAttributes, //String[]
exportColumns, //String[]
formatColumns, //String[]
printTitles, //boolean
fileAppend //Boolean
);

Details

ArgumentTypeDescription
fileNameStringfile name; it can includes a subpath to append to the base path specified through directoryId
overwriteBooleantrue to overwrite the file content if already exists, false to ignore this operation and returns false as result
directoryIdLongdirectory id directory identifier, used to define the absolute path, in the central server, where the file will be stored; if null, there must be one only entry for this application
dataListlist of data for csv
sepStringseparator of values
languageIdStringlanguage for translation
exportAttributesString[]attributes of export columns
exportColumnsString[]title of columns
formatColumnsString[]optional array of format patterns (e.g. date or number format) applied to each column during export; null entries mean no formatting for that column
printTitlesbooleantrue to print column titles as the first row in the CSV file, false to omit them
fileAppendBooleantrue if you want append data on existing file

✅ Returns

a message error, in case of errors, or "" if the CSV file has been created correctly


createCSVFile​

Create a csv file

Syntax

//return String type
var risp = utils.createCSVFile(
fileName, //String
overwrite, //Boolean
directoryId, //Long
data, //List
sep, //String
languageId, //String
exportAttributes, //String[]
exportColumns, //String[]
formatColumns, //String[]
printTitles //boolean
);

Details

ArgumentTypeDescription
fileNameStringfile name; it can includes a subpath to append to the base path specified through directoryId
overwriteBooleantrue to overwrite the file content if already exists, false to ignore this operation and returns false as result
directoryIdLongdirectory id directory identifier, used to define the absolute path, in the central server, where the file will be stored; if null, there must be one only entry for this application
dataListlist of data for csv
sepStringseparator of values
languageIdStringlanguage for translation
exportAttributesString[]attributes of export columns
exportColumnsString[]title of columns
formatColumnsString[]optional array of format patterns (e.g. date or number format) applied to each column during export; null entries mean no formatting for that column
printTitlesbooleantrue to print column titles as the first row in the CSV file, false to omit them

✅ Returns

a message error, in case of errors, or "" if the CSV file has been created correctly


createChatContact​

Create a contact (person) in the chat.

Syntax

//return Con89ChatContact type
var risp = utils.createChatContact(
person //Con89ChatContact
);

Details

ArgumentTypeDescription
personCon89ChatContactchat contact descriptor to create; it should contain myPhoneNumber plus the contact data to persist, such as contactType, contactPhoneNumber/contactName for a single contact, or groupId/contactPhoneNumbers/contactNames for a group.

createChatGroup​

Create a new chat group and add a few contacts to it.

Syntax

//return Con89ChatContact type
var risp = utils.createChatGroup(
groupName, //String
myPhoneNumber, //String
contactNames, //String>
contactPhoneNumbers //String>
);

Details

ArgumentTypeDescription
groupNameStringgroup name
myPhoneNumberStringphone number to start with
contactNamesString>display names of the contacts to include in the new group, in the same positional order as contactPhoneNumbers.
contactPhoneNumbersString>list of contacts to add

createDbTableMetadata​

Syntax

//return Long type
var risp = utils.createDbTableMetadata(
datasourceId, //Long
tableName //String
);

Details

ArgumentTypeDescription
datasourceIdLongnum value; it can be null and used to specify a different db to use with the sql statement
tableNameStringString: name of table

⚠️ Throws

  • Throwable

createEntry​

Create a new entry identified by the entry name + baaseDN

Syntax

//return String type
var risp = utils.createEntry(
host, //String
port, //Integer
ldapUsername, //String
ldapPassword, //String
baseDN, //String
entryName, //String
entryType, //String
entryDescription, //String
attributeNamesValues //String[]
);

Details

ArgumentTypeDescription
hostStringLDAP host
portIntegerLDAP port (optional: if not specified, 389 will be used)
ldapUsernameStringusername to use to authenticate to the LDAP server
ldapPasswordStringpassword to use to authenticate to the LDAP server
baseDNStringbase DN to apply as a filter
entryNameStringnew entry to create within the baseDN
entryTypeStringtype of entry, e.g. "group"
entryDescriptionStringentry description; can be null
attributeNamesValuesString[]list of attributename,attributevalue,...

✅ Returns

DN related to the entry just created


createFTPDirectories​

Create the specified folders in to the FTP server.

Syntax

//return boolean type
var risp = utils.createFTPDirectories(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
directories //String
);

Details

ArgumentTypeDescription
protocolStringFTP protocol type to use for the connection, for example FTP, FTPS, or SFTP.
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
directoriesStringto create in the FTP server

✅ Returns

true if the folders has been created in the FTP server correctly


createGroup​

Create a new group (a new entry) identified by the group name + the folderDN

Syntax

//return String type
var risp = utils.createGroup(
host, //String
port, //Integer
ldapUsername, //String
ldapPassword, //String
baseDN, //String
folderDN, //String
groupName, //String
additionalAttributeNamesValues //String[]
);

Details

ArgumentTypeDescription
hostStringLDAP host
portIntegerLDAP port (optional: if not specified, 389 will be used)
ldapUsernameStringusername to use to authenticate to the LDAP server
ldapPasswordStringpassword to use to authenticate to the LDAP server
baseDNStringbase DN
folderDNStringDN where to create the group
groupNameStringname of the LDAP group to create inside folderDN/baseDN.
additionalAttributeNamesValuesString[]list of attributename=attributevalue separated by a comma (,)

✅ Returns

DN related to the entry just created


createRoleForApplication​

Creates a new role for a specific application.

Syntax

//return Prm02Role type
var risp = utils.createRoleForApplication(
appId, //String
companyId, //String
siteId, //Long
roleId, //String
description //String
);

Details

ArgumentTypeDescription
appIdStringthe target application identifier
companyIdStringthe company identifier
siteIdLongthe site identifier
roleIdStringthe unique role identifier
descriptionStringthe role description (label)

✅ Returns

the created Prm02Role object

⚠️ Throws

  • Throwable in case of errors

createRole​

Creates a new role for the current application.

Syntax

//return Prm02Role type
var risp = utils.createRole(
companyId, //String
siteId, //Long
roleId, //String
description //String
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
roleIdStringthe unique role identifier
descriptionStringthe role description (label)

✅ Returns

the created Prm02Role object

⚠️ Throws

  • Throwable in case of errors

createTextFile​

Create a text file and fill in with the passed content.

Syntax

//return boolean type
var risp = utils.createTextFile(
fileName, //String
fileContent, //String
overwrite, //Boolean
directoryId, //Long
charset //String
);

Details

ArgumentTypeDescription
fileNameStringfile name; it can includes a subpath to append to the base path specified through directoryId
fileContentStringtext content to save
overwriteBooleantrue to overwrite the file content if already exists, false to ignore this operation and returns false as result
directoryIdLongdirectory id directory identifier, used to define the absolute path, in the central server, where the file will be stored; if null, there must be one only entry for this application
charsetStringoptional character encoding to use when writing the file (e.g. "UTF-8", "ISO-8859-1"); if null or empty, the platform default charset is used

✅ Returns

true if the operation has been successfully completed, false otherwise


createTextFile​

Create a text file and fill in with the passed content.

Syntax

//return boolean type
var risp = utils.createTextFile(
fileName, //String
fileContent, //String
overwrite, //Boolean
directoryId //Long
);

Details

ArgumentTypeDescription
fileNameStringfile name; it can includes a subpath to append to the base path specified through directoryId
fileContentStringtext content to save
overwriteBooleantrue to overwrite the file content if already exists, false to ignore this operation and returns false as result
directoryIdLongdirectory id directory identifier, used to define the absolute path, in the central server, where the file will be stored; if null, there must be one only entry for this application

✅ Returns

true if the operation has been successfully completed, false otherwise


createUser​

Creates a new user in the platform with the specified credentials and optional additional attributes and roles.

Syntax

//return Prm01User type
var risp = utils.createUser(
companyId, //String
siteId, //Long
userCodeId, //String
description, //String
password, //String
languageId, //String
user, //Map
roles //Map[]
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier for the new user
siteIdLongthe site identifier for the new user
userCodeIdStringthe user code identifier (will be converted to uppercase)
descriptionStringa descriptive label for the user
passwordStringthe user's password (will be encrypted if the platform is configured for password encryption)
languageIdStringthe language identifier for the user
userMap(optional) a Map of additional user attributes to set; keys are attribute names (e.g. "email", "firstName", "lastName", "telephone") that map to setter methods of Prm01User via reflection. If null or empty, default values are applied.
rolesMap[](optional) an array of Maps defining roles to assign to the user. Each Map must contain: (details below)

roles​

(optional) an array of Maps defining roles to assign to the user. Each Map must contain:

  • "roleId" (String) — the role identifier
  • "siteId" (Number) — the site ID for the role
  • "startDate" (java.util.Date) — role validity start date
  • "endDate" (java.util.Date, optional) — role validity end date

✅ Returns

the created Prm01User object, or null on error

⚠️ Throws

  • Throwable in case of errors

createValueImports​

Creates a new Value Import configuration for importing data from an Excel file into a database table. A Value Import defines the mapping between Excel cell coordinates and database table fields.

Syntax

//return Long type
var risp = utils.createValueImports(
dbTableId, //Long
directoryId, //Long
fileName, //String
description, //String
note, //String
inputData, //String
breakOnColumnsEmpty, //Long
breakOnRowsEmpty //Long
);

Details

ArgumentTypeDescription
dbTableIdLongthe database table identifier to import data into (required)
directoryIdLongthe platform directory identifier where the Excel source file is located (required)
fileNameStringthe Excel file name to use as source (required)
descriptionStringan optional textual description for this import configuration
noteStringan optional note associated with this import configuration
inputDataStringJSON-formatted text defining the cell-to-field mapping (required)
breakOnColumnsEmptyLongthe number of consecutive empty columns that signal end of data; defaults to 5 if null
breakOnRowsEmptyLongthe number of consecutive empty rows that signal end of data; defaults to 5 if null

✅ Returns

the newly created Value Import identifier (Long)

⚠️ Throws

  • Throwable if a server error occurs during creation

debugAll​

return all variables names+values, as a JSON string

Syntax

//return String type
var risp = utils.debugAll();

✅ Returns

all variables names+values, as a JSON string


debugVariable​

Extract the variable value defined withing this action.

Syntax

//return String type
var risp = utils.debugVariable(
variableName //String
);

Details

ArgumentTypeDescription
variableNameStringname of the JavaScript variable to inspect; dotted notation such as parent.child is supported for nested maps.

✅ Returns

variable name=value as a string


debug​

Logs a message at DEBUG level. Shorthand for log(msg, "DEBUG").

Syntax

utils.debug(
msg //String
);

Details

ArgumentTypeDescription
msgStringthe log message text @see #log(String, String)

decodeBase64​

Decodes a Base64-encoded string into its original UTF-8 text representation.

Syntax

//return String type
var risp = utils.decodeBase64(
plainText //String
);

Details

ArgumentTypeDescription
plainTextStringthe Base64-encoded string to decode

✅ Returns

the decoded UTF-8 string


decodeEncToken​

Decript a token.

Syntax

//return String type
var risp = utils.decodeEncToken(
encToken //String
);

Details

ArgumentTypeDescription
encTokenStringencrypted token text to decrypt.

✅ Returns

decripted token


decodeFile​

Decrypts a file stored in a platform directory. The source file is downloaded from the file management system, decrypted using the platform's decoding algorithm, and the resulting decrypted file is uploaded back to the same directory.

Syntax

//return Boolean type
var risp = utils.decodeFile(
sorgDirId, //Long
sorgFileName, //String
destFileName, //String
removeSorgFile //Boolean
);

Details

ArgumentTypeDescription
sorgDirIdLongthe platform directory ID where the encrypted source file is located
sorgFileNameStringthe name of the encrypted source file to decrypt (may include a relative sub-path)
destFileNameStringthe name for the decrypted output file
removeSorgFileBooleanif true, the original encrypted file is deleted after decryption

✅ Returns

true if the operation completes successfully, or null if the directory ID is invalid

⚠️ Throws

  • Throwable if a file access, I/O, or decryption error occurs

decodePassword​

Decript a password.

Syntax

//return String type
var risp = utils.decodePassword(
encriptedPassword //String
);

Details

ArgumentTypeDescription
encriptedPasswordStringencrypted password text previously produced by the platform encoder.

✅ Returns

decripted password


deleteApplUserParameter​

Deletes one or more application-level user parameters for a specific user. Removes Prm40ApplUserPar records identified by the given code IDs.

Syntax

//return ListResponse type
var risp = utils.deleteApplUserParameter(
companyId, //String
siteId, //Long
userCodeId, //String
parameters //Map[]
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
userCodeIdStringthe user code whose parameters are being deleted
parametersMap[]an array of Maps, each representing a parameter to delete. Expected keys: (details below)

parameters​

an array of Maps, each representing a parameter to delete. Expected keys:

  • "codeId" (String) — the parameter code identifier to delete (required)

✅ Returns

a ListResponse containing the result of the delete operation, or null if an error occurs

⚠️ Throws

  • Throwable if a server communication error occurs

deleteCompanyRelation​

Deletes one or more subject relations for a user within a company. Looks up the user by company/site/userCode, then removes the Sub38SubRelation entries linking the user's subject to the specified company subject for the given relation types.

Syntax

//return ListResponse type
var risp = utils.deleteCompanyRelation(
companyId, //String
siteId, //Long
companySubjectId, //String
userCodeId, //String
relations //Map[]
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
companySubjectIdStringthe parent subject identifier (company subject) the relation is with
userCodeIdStringthe user code (will be uppercased) whose subject relations are being removed
relationsMap[]an array of Maps, each representing a relation to delete. Expected keys: (details below)

relations​

an array of Maps, each representing a relation to delete. Expected keys:

  • "relationSubId" (String) — the relation sub-type identifier (SUB39)

✅ Returns

a ListResponse containing the result of the delete operation, or null if an error occurs

⚠️ Throws

  • Throwable if a server communication error occurs

deleteFTPDirectory​

Deletes a remote directory on an FTP/SFTP server. If the directory is not empty and forceIsNotEmpty is true, all contents are recursively removed before deleting the directory.

Syntax

//return boolean type
var risp = utils.deleteFTPDirectory(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
remoteDir, //String
forceIsNotEmpty, //Boolean
sessionTimeout //Integer
);

Details

ArgumentTypeDescription
protocolStringthe FTP protocol type (e.g. "FTP", "FTPS", "SFTP")
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
remoteDirStringthe remote directory path to remove
forceIsNotEmptyBooleanif true, forces deletion even when the directory contains files or subdirectories
sessionTimeoutIntegerseconds of timeout for the FTP session

✅ Returns

true if the directory was deleted successfully, false if an error occurred

⚠️ Throws

  • Throwable declared but internally caught; errors are silently handled returning false

deleteFTPFile [Deprecated]​

Delete a remote file stored in a folder of the FTP server.

Syntax

//return boolean type
var risp = utils.deleteFTPFile(
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
remoteDir, //String
fileName //String
);

Details

ArgumentTypeDescription
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
remoteDirStringfolder in the FTP server to read
fileNameStringfile to delete

deleteFTPFile​

Delete a remote file stored in a folder of the FTP server.

Syntax

//return boolean type
var risp = utils.deleteFTPFile(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
remoteDir, //String
fileName, //String
sessionTimeout //Integer
);

Details

ArgumentTypeDescription
protocolStringFTP protocol type to use for the connection, for example FTP, FTPS, or SFTP.
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
remoteDirStringfolder in the FTP server to read
fileNameStringfile to delete
sessionTimeoutIntegerseconds of timeout session

deleteFTPFile​

Delete a remote file stored in a folder of the FTP server.

Syntax

//return boolean type
var risp = utils.deleteFTPFile(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
remoteDir, //String
fileName //String
);

Details

ArgumentTypeDescription
protocolStringFTP protocol type to use for the connection, for example FTP, FTPS, or SFTP.
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
remoteDirStringfolder in the FTP server to read
fileNameStringfile to delete

deleteMappedObject​

Execute an DELETE SQL statement into the specified table, starting from the javascript NEUTRAL object passed as argument, containing many more attributes, not all related to such a table. The right attributes to take into account from the neutral object will be selected using the mapping defined to the specified data model and table name. All object attributes will be converted to database fields (uncamel format); example: productCode -> PRODUCT_CODE A pks set is also needed in order to generate the right WHERE clause

Syntax

//return boolean type
var risp = utils.deleteMappedObject(
neutralObject, //Map
dataModelId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pks //String[]
);

Details

ArgumentTypeDescription
neutralObjectMapjavascript object to insert into the specified table
dataModelIdLongdata model id, which MUST have MAPPER type, containing the mapping needed to extract the right attributes
separatedTransactionBooleanflag used to define if this query has to be perfomed in a separated transaction
interruptExecutionBooleanflag used to defined if the whole server side transation must be interruped and rollbacked in case of errors
pksString[]attribute names, expressed in camelCase, that compose the primary key/WHERE clause used to identify the record to delete.

✅ Returns

true if the record has been successfully deleted

⚠️ Throws

  • Throwable in case of errors

deleteMappedObject​

Execute an DELETE SQL statement into the specified table, starting from the javascript NEUTRAL object passed as argument, containing many more attributes, not all related to such a table. The right attributes to take into account from the neutral object will be selected using the mapping defined to the specified data model and table name. All object attributes will be converted to database fields (uncamel format); example: productCode -> PRODUCT_CODE A pks set is also needed in order to generate the right WHERE clause

Syntax

//return boolean type
var risp = utils.deleteMappedObject(
neutralObject, //Map
tableName, //String
dataModelId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pks //String[]
);

Details

ArgumentTypeDescription
neutralObjectMapjavascript object to insert into the specified table
tableNameStringtable name which must be defined as a writable object
dataModelIdLongdata model id, which MUST have MAPPER type, containing the mapping needed to extract the right attributes
separatedTransactionBooleanflag used to define if this query has to be perfomed in a separated transaction
interruptExecutionBooleanflag used to defined if the whole server side transation must be interruped and rollbacked in case of errors
pksString[]attribute names, expressed in camelCase, that compose the primary key/WHERE clause used to identify the record to delete.

✅ Returns

true if the record has been successfully deleted

⚠️ Throws

  • Throwable in case of errors

deleteMessages​

Delete a list of messages in the email server.

Syntax

//return Boolean type
var risp = utils.deleteMessages(
server, //String
port, //Integer
username, //String
password, //String
protocol, //String
useTLS, //Boolean
messageIdsToDelete, //String[]
messageNumbersToDelete, //Integer[]
folderName, //String
trashName //String
);

Details

ArgumentTypeDescription
serverStringserver host
portIntegerserver port
usernameStringusername to use when accessing the email server
passwordStringpassword to use when accessing the email server
protocolStringprotocol to use when connecting to the email server
useTLSBooleanflag used to enabled the TLS mode
messageIdsToDeleteString[]list of message ids found in the email server, filtered according to the specified filter values
messageNumbersToDeleteInteger[]list of message numbers found in the email server, filtered according to the specified filter values
folderNameStringname of the folder where the messages to delete are located
trashNameStringtrash name. If not found, the list of folders will be logged out

✅ Returns

true if delete has been completed successfully, `false otherwise


deleteMessages​

Delete a list of messages in the email server.

Syntax

//return Boolean type
var risp = utils.deleteMessages(
server, //String
port, //Integer
username, //String
password, //String
protocol, //String
useTLS, //Boolean
messagesToDelete, //String[]
startSendDateFilter, //Date
endSendDateFilter, //Date
startReceiveDateFilter, //Date
endReceiveDateFilter, //Date
folderName, //String
trashName //String
);

Details

ArgumentTypeDescription
serverStringserver host
portIntegerserver port
usernameStringusername to use when accessing the email server
passwordStringpassword to use when accessing the email server
protocolStringprotocol to use when connecting to the email server
useTLSBooleanflag used to enabled the TLS mode
messagesToDeleteString[]list of message identifiers to delete before applying the date-based folder/trash logic.
startSendDateFilterDateoptional parameter; if not null, messages to read will be filtered by sending date: only the ones next or equal to this date wil be returned
endSendDateFilterDateoptional parameter; if not null, messages to read will be filtered by sending date: only the ones previous or equal to this date wil be returned
startReceiveDateFilterDateoptional parameter; if not null, messages to read will be filtered by receiving date: only the ones next or equal to this date wil be returned
endReceiveDateFilterDateoptional parameter; if not null, messages to read will be filtered by receiving date: only the ones previous or equal to this date wil be returned
folderNameStringname of the folder where the messages to delete are located
trashNameStringtrash name. If not found, the list of folders will be logged out

✅ Returns

true if delete has been completed successfully, `false otherwise


deleteObject​

Execute a DELETE SQL statement into the specified table, starting from the javascript object passed as argument. All object attributes will be converted to database fields (uncamel format); example: productCode -> PRODUCT_CODE

Syntax

//return boolean type
var risp = utils.deleteObject(
obj, //Map
tableName, //String
dataSourceId, //Long
separatedTransaction, //Boolean
interruptExecution //Boolean
);

Details

ArgumentTypeDescription
objMapjavascript object whose keys are attribute names in camelCase and whose values identify the record to delete; in practice it should contain the table primary-key attributes and any additional fields required by the delete logic.
tableNameStringtable name which must be defined as a writable object (iut must have a data mode)
dataSourceIdLongoptional data source id
separatedTransactionBooleanflag used to define if this query has to be perfomed in a separated transaction
interruptExecutionBooleanflag used to defined if the whole server side transation must be interruped and rollbacked in case of errors

✅ Returns

true if the record has been successfully deleted

⚠️ Throws

  • Throwable in case of errors

deleteValueImport​

Physically deletes all data associated with a Value Import configuration, including the import header, cell mappings, and any related metadata.

Syntax

//return String type
var risp = utils.deleteValueImport(
valueImportId //Long
);

Details

ArgumentTypeDescription
valueImportIdLongthe identifier of the Value Import to delete

✅ Returns

a result string indicating the outcome of the deletion

⚠️ Throws

  • Throwable if a server error occurs during deletion

dequeueProcess​

Remove the specified process instance from the queue.

Syntax

//return boolean type
var risp = utils.dequeueProcess(
queueName, //String
progressive //Long
);

Details

ArgumentTypeDescription
queueNameStringname of the queue containing the process to remove.
progressiveLongprogressive identifier of the queued process instance to remove.

✅ Returns

false if the process has been already terminated or does not exist


disableValueImport​

Logically deletes (disables) a Value Import configuration by marking its header as inactive. The import data is retained but the configuration is no longer usable until re-enabled.

Syntax

//return String type
var risp = utils.disableValueImport(
valueImportId //Long
);

Details

ArgumentTypeDescription
valueImportIdLongthe identifier of the Value Import to disable

✅ Returns

a result string indicating the outcome of the operation

⚠️ Throws

  • Throwable if a server error occurs during the disable operation

duplicateBlobInPRM17​

Duplicate the BLOB content (ACTIVATION_KEY) in PRM17_APPLICATIONS from one company to another.

Syntax

//return Integer type
var risp = utils.duplicateBlobInPRM17(
appId, //String
fromCompanyId, //String
toCompanyId //String
);

Details

ArgumentTypeDescription
appIdStringapplication identifier used to locate the PRM17 record
fromCompanyIdStringsource company identifier from which the BLOB is read
toCompanyIdStringtarget company identifier where the BLOB will be written

✅ Returns

number of processed (updated) rows

⚠️ Throws

  • Throwable in case of database or I/O errors

duplicateValueImports​

Duplicates an existing Value Import configuration, optionally overriding the source file and metadata. Creates a new Value Import based on an existing one, preserving cell-to-field mappings.

Syntax

//return String type
var risp = utils.duplicateValueImports(
valueImportId, //Long
directoryId, //Long
fileName, //String
description, //String
note, //String
inputData, //String
breakOnColumnsEmpty, //Long
breakOnRowsEmpty, //Long
ignoreSheet //Boolean
);

Details

ArgumentTypeDescription
valueImportIdLongthe identifier of the existing Value Import to duplicate (required)
directoryIdLongoptional platform directory identifier; if null, keeps the original directory
fileNameStringoptional new file name; if null, keeps the original file reference
descriptionStringoptional new description; if null, keeps the original description
noteStringoptional new note; if null, keeps the original note
inputDataStringJSON-formatted text defining the cell-to-field mapping (required)
breakOnColumnsEmptyLongthe number of consecutive empty columns that signal end of data; defaults to 5 if null
breakOnRowsEmptyLongthe number of consecutive empty rows that signal end of data; defaults to 5 if null
ignoreSheetBooleanif true, skips sheet comparison with the previous mapping and removes stale references

✅ Returns

a JSON string with the result of the duplication operation

⚠️ Throws

  • Throwable if a server error occurs or the source Value Import does not exist

duplicateValueImports​

Duplicates an existing Value Import configuration, optionally overriding the source file and metadata. Creates a new Value Import based on an existing one, preserving cell-to-field mappings.

Syntax

//return String type
var risp = utils.duplicateValueImports(
valueImportId, //Long
directoryId, //Long
fileName, //String
description, //String
note, //String
inputData, //String
breakOnColumnsEmpty, //Long
breakOnRowsEmpty //Long
);

Details

ArgumentTypeDescription
valueImportIdLongthe identifier of the existing Value Import to duplicate (required)
directoryIdLongoptional platform directory identifier; if null, keeps the original directory
fileNameStringoptional new file name; if null, keeps the original file reference
descriptionStringoptional new description; if null, keeps the original description
noteStringoptional new note; if null, keeps the original note
inputDataStringJSON-formatted text defining the cell-to-field mapping (required)
breakOnColumnsEmptyLongthe number of consecutive empty columns that signal end of data; defaults to 5 if null
breakOnRowsEmptyLongthe number of consecutive empty rows that signal end of data; defaults to 5 if null

✅ Returns

a JSON string with the result of the duplication operation

⚠️ Throws

  • Throwable if a server error occurs or the source Value Import does not exist

encodeFile​

Encrypts a file stored in a platform directory. The source file is downloaded from the file management system, encrypted using the platform's encoding algorithm, and the resulting encrypted file is uploaded back to the same directory.

Syntax

//return Boolean type
var risp = utils.encodeFile(
sorgDirId, //Long
sorgFileName, //String
destFileName, //String
removeSorgFile //Boolean
);

Details

ArgumentTypeDescription
sorgDirIdLongthe platform directory ID where the source file is located
sorgFileNameStringthe name of the source file to encrypt (may include a relative sub-path)
destFileNameStringthe name for the encrypted output file
removeSorgFileBooleanif true, the original source file is deleted after encryption

✅ Returns

true if the operation completes successfully, or null if the directory ID is invalid

⚠️ Throws

  • Throwable if a file access, I/O, or encryption error occurs

encodePassword​

Encript a password.

Syntax

//return String type
var risp = utils.encodePassword(
password //String
);

Details

ArgumentTypeDescription
passwordStringplain-text password to encrypt using the platform utility encoder.

enqueueActionWithNoteAsString​

Syntax

//return String type
var risp = utils.enqueueActionWithNoteAsString(
queueName, //String
actionId, //Long
params, //Map
priority, //String
processWaitTime, //Long
logExecution, //Boolean
note, //String
maxRetries //Integer
);

Details

ArgumentTypeDescription
queueNameStringoptional queue name; if null or empty, the default queue is used.
actionIdLongserver-side JavaScript action identifier to enqueue.
paramsMapmap passed to the queued action as its input object; supported keys include queueTimeout, actionIdWhenFinished, actionIdWhenTimeout, maxNumberRetries, waitTimespan, and actionIdWhenError.
priorityStringoptional queue priority used to sort processes inside the queue.
processWaitTimeLongoptional delay in seconds before the queued process becomes eligible for execution.
logExecutionBooleantrue to write execution details into LOG60_LOGS.
noteStringoptional note stored together with the queued process entry.
maxRetriesIntegeroptional maximum retry count stored with the queued request when retry handling is enabled.

✅ Returns

the element id is returned as a String


enqueueActionWithNote​

Add a server-side JS action as a process to a specific queue.

Syntax

//return Long type
var risp = utils.enqueueActionWithNote(
queueName, //String
actionId, //Long
params, //Map
priority, //String
processWaitTime, //Long
logExecution, //Boolean
note //String
);

Details

ArgumentTypeDescription
queueNameStringoptional: queue name; if not specified, the process will be enqueued in the DEFAULT queue
actionIdLongserver-side JS action id
paramsMapmap of parameters to pass to the action (as "vo" argument); if it is filled and there is an attribute named "queueTimeout", then its value, expressed in minutes, will be used to force its termination if it is filled and there is an attribute named "actionIdWhenFinished", then the specified server-side js action will be automatically invoked at the end of the process if it is filled and there is an attribute named "actionIdWhenTimeout", then the specified server-side js action will be automatically invoked in case the process has timeouted if it is filled and there are 2 attributes named "maxNumberRetries" and "waitTimespan", then the current action will be re-enqueued with a wait of "waitTimespan" seconds and it will retry for up to "maxNumberRetries" times if it is filled and there is an attribute named "actionIdWhenError", then the specified server-side js action will be automatically invoked if the action fires and error (and terminates); this event is postponed in case "maxNumberRetries" and "waitTimespan" have been filled
priorityStringoptional; if specified, processes within the same queue will be sorted according to the priority rather than to the enqueing time
processWaitTimeLongoptional; if specified, the process will not be started before that time, expressed in seconds
logExecutionBooleantrue to log in LOG60_LOGS the execution of the process
noteStringoptional textual note to associate with the enqueued process, useful for debugging or auditing purposes

✅ Returns

null in case of errors, the queue's element identifier within the queue


enqueueAction​

Add a server-side JS action as a process to a specific queue.

Syntax

//return Long type
var risp = utils.enqueueAction(
queueName, //String
actionId, //Long
params, //Map
priority, //String
processWaitTime, //Long
logExecution //Boolean
);

Details

ArgumentTypeDescription
queueNameStringoptional: queue name; if not specified, the process will be enqueued in the DEFAULT queue
actionIdLongserver-side JS action id
paramsMapmap of parameters to pass to the action (as "vo" argument); if it is filled and there is an attribute named "queueTimeout", then its value, expressed in minutes, will be used to force its termination.
priorityStringoptional; if specified, processes within the same queue will be sorted according to the priority rathe than to the enqueing time
processWaitTimeLongoptional; if specified, the process will not be started before that time, expressed in seconds
logExecutionBooleantrue to log in LOG60_LOGS the execution of the process

✅ Returns

null in case of errors, the queue's element identifier within the queue


enqueueActionsFromSqlQuery​

Executes the specified SQL query on the given datasource and, for each resulting record, enqueues the specified action in the named queue, passing the record data as input.

Syntax

utils.enqueueActionsFromSqlQuery(
queueName, //String
payload, //String
actionId, //Long
datasourceId, //Long
sqlQuery, //String
params //Object[]
);

Details

ArgumentTypeDescription
queueNameStringthe name of the queue where actions will be enqueued
payloadStringan optional payload string to include with each enqueued action
actionIdLongthe server-side action identifier to execute for each record
datasourceIdLongthe platform datasource identifier to execute the SQL query against
sqlQueryStringthe SQL SELECT query to execute; each result row triggers an action enqueue
paramsObject[]optional bind parameters for the SQL query (positional placeholders)

⚠️ Throws

  • Throwable if the query execution or enqueue operation fails

enqueueShellCommand​

Add shell command as a process to a specific queue.

Syntax

//return Long type
var risp = utils.enqueueShellCommand(
queueName, //String
cmd, //String
priority, //String
processWaitTime, //Long
logExecution //Boolean
);

Details

ArgumentTypeDescription
queueNameStringoptional: queue name; if not specified, the process will be enqueued in the DEFAULT queue
cmdStringshell command to execute
priorityStringoptional; if specified, processes within the same queue will be sorted according to the priority rathe than to the enqueing time
processWaitTimeLongoptional; if specified, the process will not be started before that time, expressed in seconds
logExecutionBooleantrue to log in LOG60_LOGS the execution of the process

✅ Returns

null in case of errors, the queue's element identifier within the queue


enqueueWebService​

Add a web service invocation as a process to a specific queue.

Syntax

//return Long type
var risp = utils.enqueueWebService(
queueName, //String
url, //String
params, //Map
priority, //String
processWaitTime, //Long
logExecution //Boolean
);

Details

ArgumentTypeDescription
queueNameStringoptional: queue name; if not specified, the process will be enqueued in the DEFAULT queue
urlStringURI of the web service to call
paramsMapmap of parameters to pass to the action (as "vo" argument)
priorityStringoptional; if specified, processes within the same queue will be sorted according to the priority rathe than to the enqueing time
processWaitTimeLongoptional; if specified, the process will not be started before that time, expressed in seconds
logExecutionBooleantrue to log in LOG60_LOGS the execution of the process

✅ Returns

null in case of errors, the queue's element identifier within the queue


error​

Logs a message at ERROR level. Shorthand for log(msg, "ERROR").

Syntax

utils.error(
msg //String
);

Details

ArgumentTypeDescription
msgStringthe log message text @see #log(String, String)

executeMappedQueryWithCallback​

Starting from a MAPPER type data model, execute a SQL query automatically generated, starting from the SELECT and FROM clauses defined through a mapping to a specific data source id (inherited at application level), combined with the WHERE, ORDER BY, GROUP BY and HAVING clauses specified here. A JavaScript callback function is invoked for each row read from the result set, allowing row-by-row processing without loading the entire result set into memory.

Syntax

function callbackFunName(data) \{

\}

utils.executeMappedQueryWithCallback(
callbackFunName, //String
where, //String
groupBy, //String
having, //String
orderBy, //String
dataModelId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pars //Object[]
);

Details

ArgumentTypeDescription
callbackFunNameStringthe name of the JavaScript callback function to invoke for each row; the function receives a JSON object representing one result row
whereStringoptional argument: if filled in, it represents the WHERE condition to append to the base SQL query (DO NOT specify the WHERE keyword)
groupByStringoptional argument: if filled in, it represents the GROUP BY condition to append to the base SQL query (DO NOT specify the GROUP BY keyword)
havingStringoptional argument: if filled in, it represents the HAVING condition to append to the base SQL query (DO NOT specify the HAVING keyword)
orderByStringoptional argument: if filled in, it represents the ORDER BY condition to append to the base SQL query (DO NOT specify the ORDER BY keyword)
dataModelIdLongrequired data model id, which must have a MAPPER type
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
parsObject[]optional bind parameters for the SQL query, corresponding to ? placeholders in the SQL string, in positional order

⚠️ Throws

  • Throwable if a database error occurs, or if the callback function throws a RuntimeException (which will interrupt the entire row processing)
  • RuntimeException if the specified dataModelId is invalid or does not reference a MAPPER type data model

executeMappedQuery​

Starting from a MAPPER type data model, execute a SQL query automatically generated, starting from the SELECT and FROM clauses defined through a mapping to a specific data source id (inherited at application level), combined with the WHERE, ORDER BY, GROUP BY and HAVING clauses specified here. This method returns the WHOLE result set, expressed as a JSON list of objects.

Syntax

//return String type
var risp = utils.executeMappedQuery(
where, //String
groupBy, //String
having, //String
orderBy, //String
dataModelId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pars //Object[]
);

Details

ArgumentTypeDescription
whereStringoptional argument: if filled in, it represents the WHERE condition to append to the base SQL query (DO NOT specify the WHERE keyword)
groupByStringoptional argument: if filled in, it represents the GROUP BY condition to append to the base SQL query (DO NOT specify the GROUP BY keyword)
havingStringoptional argument: if filled in, it represents the HAVING condition to append to the base SQL query (DO NOT specify the HAVING keyword)
orderByStringoptional argument: if filled in, it represents the ORDER BY condition to append to the base SQL query (DO NOT specify the ORDER BY keyword)
dataModelIdLongrequired data model id, which must have a MAPPER type
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
parsObject[]optional bind parameters for the SQL query, corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

a JSON string representing the entire result set as an array of objects

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true
  • RuntimeException if the specified dataModelId is invalid or does not reference a MAPPER type data model

executeQueryReplaceVariables​

Execute a SQL SELECT query on the specified data source, after replacing platform variables within the SQL string that match the given prefix, and return the entire result set as a JSON string.

Syntax

//return String type
var risp = utils.executeQueryReplaceVariables(
sql, //String
variablePrefix, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pars //Object[]
);

Details

ArgumentTypeDescription
sqlStringthe SQL SELECT query to execute, potentially containing platform variables
variablePrefixStringthe prefix used to identify variables within the SQL string that should be replaced with their runtime values (e.g., ":" for :VARIABLE_NAME)
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
parsObject[]optional bind parameters for the SQL query, corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

a JSON string representing the result set as an array of objects

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true

executeQueryWithAlias​

Execute a SQL SELECT query on the specified data source and return the result set as a JSON string, using column aliases defined by the given data model. When a dataModelId is provided, the result columns are renamed according to the alias mappings configured in that data model.

Syntax

//return String type
var risp = utils.executeQueryWithAlias(
sql, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
dataModelId, //Long
pars //Object[]
);

Details

ArgumentTypeDescription
sqlStringthe SQL SELECT query to execute
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
dataModelIdLongoptional data model id used to resolve column aliases; if null, column names from the result set metadata are used as-is
parsObject[]optional bind parameters for the SQL query, corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

a JSON string representing the result set as an array of objects, with column names potentially aliased according to the specified data model

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true

executeQueryWithCallback​

Execute a SQL SELECT query on the specified data source and invoke a JavaScript callback function for each row read from the result set. This approach avoids loading the entire result set into memory, making it suitable for processing large data sets row by row. The specified callback function must accept a single argument: a JavaScript object representing the current row, with column names as property keys. The callback is evaluated using either the Rhino engine (cx.evaluateString) or the JSR-223 ScriptEngine, depending on which is available.

Syntax

function callbackFunName(data) \{

\}

utils.executeQueryWithCallback(
callbackFunName, //String
sql, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pars //Object[]
);

Details

ArgumentTypeDescription
callbackFunNameStringthe name of the JavaScript callback function to invoke for each row; the function receives a JSON object representing one result row
sqlStringthe SQL SELECT query to execute
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
parsObject[]optional bind parameters for the SQL query, corresponding to ? placeholders in the SQL string, in positional order

⚠️ Throws

  • Throwable if a database error occurs, or if the callback function throws a RuntimeException (which will interrupt the entire row processing)

executeQuery​

Execute a SQL SELECT query on the specified data source and return the entire result set as a JSON string. The result is a JSON array of objects, where each object represents a row with column names as keys.

Syntax

//return String type
var risp = utils.executeQuery(
sql, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pars //Object[]
);

Details

ArgumentTypeDescription
sqlStringthe SQL SELECT query to execute
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
parsObject[]optional bind parameters for the SQL query, corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

a JSON string representing the result set as an array of objects (e.g., [\{"COL1":"val1","COL2":123, ...]})

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true

executeShellCommand​

Execute a command on the shell. Optionally, a list of arguments can be passed to the command.

Syntax

//return String type
var risp = utils.executeShellCommand(
command, //String
arguments //String[]
);

Details

ArgumentTypeDescription
commandStringcommand to execute; it must include the absolute path to the command and must end with a .sh or .bat with no spaces within
argumentsString[]zero or more String type arguments; [] otherwise

✅ Returns

the exit code produced by the command execution


executeSqlBatch​

Execute a batch SQL operation that reads rows from a source query and writes them to a destination table using either INSERT, UPDATE, or UPDATE-with-INSERT-fallback (upsert) logic. The operation processes rows in configurable block sizes (default 10,000) and commits after each block, making it suitable for large data transfers between tables or databases. Behavior when updateSql is specified: Execute batch updates for N rows (where N = blockSize, default 10,000) Commit the batch For rows where update affected 0 records (record not found), execute insertSql if specified Continue until the end of the result set Behavior when only insertSql is specified: Execute batch inserts for N rows (where N = blockSize, default 10,000) Commit the batch Continue until the end of the result set

Syntax

//return Long type
var risp = utils.executeSqlBatch(
settings //Map
);

Details

ArgumentTypeDescription
settingsMapa Map containing the batch configuration with the following expected keys: (details below)

settings​

a Map containing the batch configuration with the following expected keys:

  • "selectSql" (String, required) — the SQL SELECT query to read source data. Fields in the SELECT must be in the same positional order as ? placeholders in insertSql/updateSql.
  • "srcDataStoreId" (Number, optional) — the data source id for the source query; if null, the default data source is used.
  • "selectParameters" (List, optional) — bind parameters for the selectSql query, in positional order.
  • "insertSql" (String, conditionally required) — the INSERT statement to execute for each source row. Required if updateSql is not specified. The number of ? placeholders must match the number of columns in selectSql.
  • "updateSql" (String, conditionally required) — the UPDATE statement to execute for each source row. Either insertSql or updateSql (or both) must be specified. The SET clause placeholders (?) must match the SELECT columns in order, followed by additional ? for the WHERE clause (pk fields).
  • "destDataStoreId" (Number, optional) — the data source id for the destination INSERT/UPDATE; if null, the default data source is used.
  • "blockSize" (Number, optional) — the number of rows to batch before committing; defaults to 10,000 if not specified or if value is <= 0.
  • "pk" (List, conditionally required) — list of column names (or aliases) from the SELECT clause that form the primary key, used to build the WHERE condition for updates. Required when updateSql is specified.Example (insert only): \{ selectSql: "SELECT CUSTOMER_ID,CORPORATE_NAME FROM CUSTOMERS WHERE STATUS=?", selectParameters: ["E"], insertSql: "INSERT INTO CLIENTS(CLIENT_ID,CORP_NAME,CREATE_USER,CREATE_DATE,STATUS,ROW_VERSION) VALUES(?,?,'BATCH',NOW(),'E',1)" } Example (upsert — update with insert fallback): \{ selectSql: "SELECT CUSTOMER_ID,CORPORATE_NAME FROM CUSTOMERS WHERE STATUS=?", selectParameters: ["E"], updateSql: "UPDATE CLIENTS SET CLIENT_ID=?,CORP_NAME=? WHERE ID_CLIENT=?", insertSql: "INSERT INTO CLIENTS(CLIENT_ID,CORP_NAME) VALUES(?,?)", pk: ["CUSTOMER_ID"] } Note: SELECT fields MUST be in the same positional order as ? variables in updateSql/insertSql. For updateSql, the pk columns are appended as additional ? parameters after the SET columns.

✅ Returns

the total number of rows processed (inserted + updated)

⚠️ Throws

  • Exception if a database error occurs, if required settings keys are missing, or if the datasource id is invalid/not enabled
  • RuntimeException if "selectSql" is missing, if neither "insertSql" nor "updateSql" is specified, or if "updateSql" is specified without "pk"

executeSqlFile​

Execute a series of SQL statements, stored in the specified file.

Syntax

//return Integer type
var risp = utils.executeSqlFile(
sqlFile, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pars //Object[]
);

Details

ArgumentTypeDescription
sqlFileStringabsolute path + file name, related to the SQL script to execute
dataStoreIdLongoptional datastore identifier to use when executing the SQL statements
separatedTransactionBooleanflag used to define if the SQL statements must be executed in a separated transaction
interruptExecutionBooleanflag used to define if the JS action has to be interrupted and a rollback performed, in case of errors
parsObject[]parameters required by the statements, included between square brackets []

✅ Returns

number of processed statements


executeSqlNoLog​

Execute a SQL DML statement (INSERT, UPDATE, DELETE) on the specified data source, without logging the SQL statement to the platform logger. This variant is useful for high-frequency operations where logging would produce excessive output.

Syntax

//return Integer type
var risp = utils.executeSqlNoLog(
sql, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pars //Object[]
);

Details

ArgumentTypeDescription
sqlStringthe SQL DML statement to execute (INSERT, UPDATE, DELETE)
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the statement is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
parsObject[]optional bind parameters for the SQL statement, corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

the number of rows affected by the DML statement

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true

executeSqlReplaceVariables​

Execute a SQL DML statement (INSERT, UPDATE, DELETE) on the specified data source, after replacing platform variables within the SQL string that match the given prefix. Variables in the SQL are identified by the prefix and substituted with their runtime values before execution. The SQL statement is logged.

Syntax

//return Integer type
var risp = utils.executeSqlReplaceVariables(
sql, //String
variablePrefix, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pars //Object[]
);

Details

ArgumentTypeDescription
sqlStringthe SQL DML statement to execute, potentially containing platform variables
variablePrefixStringthe prefix used to identify variables within the SQL string that should be replaced with their runtime values (e.g., ":" for :VARIABLE_NAME)
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the statement is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
parsObject[]optional bind parameters for the SQL statement, corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

the number of rows affected by the DML statement

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true

executeSql​

Execute a SQL DML statement (INSERT, UPDATE, DELETE) on the specified data source. The SQL statement is logged to the platform logger.

Syntax

//return Integer type
var risp = utils.executeSql(
sql, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pars //Object[]
);

Details

ArgumentTypeDescription
sqlStringthe SQL DML statement to execute (INSERT, UPDATE, DELETE)
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the statement is executed in a new, independent transaction (via ServerProxyFactory.getServerProxy().serverCall()) that is committed/rolled back independently of the caller's transaction; if false, the statement participates in the current transaction using a local WAGJsUtilsBean instance
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution and trigger a rollback; if false, the error is logged but execution continues
parsObject[]optional bind parameters for the SQL statement, corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

the number of rows affected by the DML statement

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true

executeStoredFunction​

Execute a stored function (or stored procedure) on the specified data source and return its result as a string. This is typically used to invoke database-level functions that return a scalar value.

Syntax

//return String type
var risp = utils.executeStoredFunction(
sql, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pars //Object[]
);

Details

ArgumentTypeDescription
sqlStringthe SQL statement to call the stored function (e.g., "\{ ? = call my_function(?, ?) "})
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the call is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
parsObject[]optional bind parameters for the stored function call, corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

the string representation of the value returned by the stored function

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true

executeValueImportFunction​

Evaluates a formula-like function expression using pre-fetched cell values from an Excel file. Supports nested function calls such as sum(...), cellValue(...), and can reference cells across multiple sheets.

Syntax

//return Object type
var risp = utils.executeValueImportFunction(
function, //String
sheetName, //String
values //Map
);

Details

ArgumentTypeDescription
functionStringthe function expression to evaluate, e.g., "sum(sum(cellValue(\"E4\"), cellValue(\"E8\")), cellValue(\"Sheet1!E9\"))"
sheetNameStringoptional default sheet name context; when cell references in the function do not include a sheet prefix, this value is used (e.g., "Sheet1")
valuesMapa Map of pre-fetched cell values where keys are cell references in the format "SheetName!CellRef" (e.g., "Sheet1!E4") and values are the corresponding cell contents (Number, String, etc.)

✅ Returns

the computed result of the function evaluation

⚠️ Throws

  • Throwable if the function expression is invalid or a server error occurs

existUser​

Checks if a user exists in the system for the given company, site, and user code.

Syntax

//return Prm01User type
var risp = utils.existUser(
companyId, //String
siteId, //Long
userCodeId //String
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
userCodeIdStringthe user code identifier (will be converted to uppercase)

✅ Returns

the Prm01User object if the user exists, or null if not found or on error


exportFromExcelFile​

Exports specific areas from a source Excel file into a new destination Excel file. Allows selective extraction of defined cell ranges (areas) from one workbook to another.

Syntax

//return boolean type
var risp = utils.exportFromExcelFile(
sourceDirId, //Long
sourceFileName, //String
destDirId, //Long
destFileName, //String
areas //List
);

Details

ArgumentTypeDescription
sourceDirIdLongthe platform directory identifier where the source Excel file is located
sourceFileNameStringthe name of the source Excel file
destDirIdLongthe platform directory identifier where the destination file will be created
destFileNameStringthe name of the destination Excel file to create
areasLista list of area definitions specifying the cell ranges to export

✅ Returns

true if the export completed successfully

⚠️ Throws

  • Throwable if a server error occurs during export

fileExists​

Check for file existence in the local file system.

Syntax

//return boolean type
var risp = utils.fileExists(
filePath //String
);

Details

ArgumentTypeDescription
filePathString

findTagsByNames​

Scroll all input nodes and for each create a js object whose attributes are the subtags having the specified tagNames.

Syntax

//return Map[] type
var risp = utils.findTagsByNames(
nodes, //Map[]
tagNames //String[]
);

Details

ArgumentTypeDescription
nodesMap[]nodes to analyze
tagNamesString[]list of tag names to compare with each subtag of each node Example: nodes = XY...... getTagValues(nodes,["firstname","lastname"]) will return js objects having this structure: { firstname: "X", lastname: "Y" }, {...}

findTagsByPath​

Search for the specified path.

Syntax

//return Map[] type
var risp = utils.findTagsByPath(
xmlDoc, //Map[]
path //String
);

Details

ArgumentTypeDescription
xmlDocMap[]XML document parsed through parseXML method
pathStringa tags path, expressed as tag1/tag2/tag3...

✅ Returns

all occurrences matching the specified path


forceCompanyId​

Force the company id to use in UserInfo.

Syntax

utils.forceCompanyId(
companyId //String
);

Details

ArgumentTypeDescription
companyIdString

forceStartProcess​

Force the starting of the specified enqueued process.

Syntax

//return boolean type
var risp = utils.forceStartProcess(
queueName, //String
progressive //Long
);

Details

ArgumentTypeDescription
queueNameStringname of the queue containing the process to start immediately.
progressiveLongprogressive identifier of the queued process instance to force-start.

✅ Returns

false if the process has been already terminated or does not exist


formatNumber​

Formats a numeric value to a string representation with configurable grouping and decimal settings.

Syntax

//return String type
var risp = utils.formatNumber(
value, //Number
grouping, //Boolean
groupingSymbol, //String
decimals, //Number
decimalSymbol //String
);

Details

ArgumentTypeDescription
valueNumberthe numeric value to format; if null, returns null
groupingBooleanif true, thousands grouping is applied
groupingSymbolStringthe character to use as thousands separator (e.g. "." or ",")
decimalsNumberthe number of decimal places to display
decimalSymbolStringthe character to use as decimal separator (e.g. "." or ",")

✅ Returns

the formatted number as a string, or null if value is null


forwardEmail​

Forward the specified email.

Syntax

//return Boolean type
var risp = utils.forwardEmail(
server, //String
port, //Integer
username, //String
password, //String
protocol, //String
useTLS, //Boolean
to, //String
subject, //String
text, //String
messageId, //String
smtpHost, //String
smtpPort, //String
smtpProtocol, //String
smtpUsername, //String
smtpPassword //String
);

Details

ArgumentTypeDescription
serverStringserver host
portIntegerserver port
usernameStringusername to use when accessing the email server
passwordStringpassword to use when accessing the email server
protocolStringprotocol to use when connecting to the email server
useTLSBooleanflag used to enabled the TLS mode
toStringdestination address
subjectStringoptional: subject to add to the original subject
textStringoptional: text to include to the original body
messageIdStringemail message identifier to forward
smtpHostStringSMTP server host used to send the forwarded email.
smtpPortStringSMTP server port used to send the forwarded email.
smtpProtocolStringSMTP transport protocol to use for the forwarded email, for example smtp or smtps.
smtpUsernameStringSMTP username used for authenticated forwarding.
smtpPasswordStringSMTP password paired with smtpUsername for authenticated forwarding.

✅ Returns

true if the email messages has been forwarded successfully, false otherwise

⚠️ Throws

  • Exception

generateXML​

Convert a JavaScript object into an XML document, mapping attribute names to XML tags and attribute values to tag content. The result is saved to a file in the specified directory.

Syntax

utils.generateXML(
jsonObj, //Map
header, //String
rootNode, //String
dirId, //Long
fileName, //String
attrMapping, //String>
listMapping, //Map
settings //Map
);

Details

ArgumentTypeDescription
jsonObjMapthe JavaScript object to convert to XML
headerStringXML header declaration (e.g. ""); can be null
rootNodeStringthe root XML tag name (e.g. "")
dirIdLongplatform directory ID where the XML file will be saved
fileNameStringthe file name to use for the generated XML document
attrMappingString>(optional: can be null); a Map<String, String> defining custom attribute-to-tag name mappings. Keys are JavaScript attribute names, values are the XML tag names to use instead. If no mapping is found for an attribute, the attribute name is used as-is for the tag
listMappingMap(optional: can be null); a Map<String, String> defining how list (array) attributes are wrapped in XML. Keys are attribute names that contain arrays; values are the XML tag name to use for each element in the list
settingsMapconfiguration map (CANNOT be null). Supported keys: (details below)

settings​

configuration map (CANNOT be null). Supported keys:

  • "toUpperCase" (Boolean) — if true, converts attribute names to upper case when creating XML tags (default: false)
  • "xsd" (String) — relative path within the web context to an .xsd file; used to determine tag order based on the sequence defined in the schema
  • "xsdValidation" (Boolean) — if true and "xsd" is specified, validates the generated XML against the schema (default: false)
  • "tabSpaces" (Integer) — number of spaces for each indentation level of nested tags (default: 2)
  • "dateFormat" (String) — date format pattern for Date objects (default: "yyyy-MM-dd")
  • "decimalFormat" (String) — numeric format pattern for numbers (default: "#.00")
  • "attributesToConvertToDate" (String[]) — array of attribute names whose values should be converted from JSON date format ("yyyy-MM-dd HH:mm:ss" or "yyyy-MM-dd") to the format specified in "dateFormat"
  • "tagSequence" (Map<String, String[]>) — for each parent tag, an ordered list of child tags defining their output sequence. Example: \{ "TAG1": ["TAG2","TAG3"], "TAG2": ["TAG4","TAG5"] }Note: either "tagSequence" or "xsd" must be specified to ensure correct tag ordering.

⚠️ Throws

  • Throwable if directory resolution fails, file I/O errors occur, or XSD validation fails

getAllFilterParams​

return an array of filter values in the same order as the WHERE clause conditions generated by getAllFilterWhere, suitable for use as PreparedStatement bind parameters

Syntax

//return Object[] type
var risp = utils.getAllFilterParams();

✅ Returns

an array of filter values in the same order as the WHERE clause conditions generated by getAllFilterWhere, suitable for use as PreparedStatement bind parameters


getAllFilterWhere​

Builds a SQL WHERE clause fragment for ALL active filter conditions using decoded field mappings. Uses the decode fields previously registered via setDecodeField() to map attribute names to table-qualified column names. The table parameter is prepended to the field names. Supports UPPER() wrapping when the filter is configured for case-insensitive matching. Example: given table = "TMP" and decoded fields for ITEM_CODE and BARCODE, the result would be "UPPER(TMP.ITEM_CODE) like ? AND TMP.BARCODE = ?".

Syntax

//return String type
var risp = utils.getAllFilterWhere(
table //String
);

Details

ArgumentTypeDescription
tableStringthe table alias or name to prefix to decoded field names

✅ Returns

a SQL WHERE clause fragment with ? placeholders for all matching decoded filter fields, or an empty string if no matching filters are active


getBasePath​

return absolute path of WEB-INF/classes folder of Platform application

Syntax

//return String type
var risp = utils.getBasePath();

✅ Returns

absolute path of WEB-INF/classes folder of Platform application


getBinaryContentWithSettings​

Execute an HTTP(s) connection and fetch the result as binary content, saving it to a local file. This variant accepts a settings Map to provide additional configuration such as custom HTTP headers.

Syntax

utils.getBinaryContentWithSettings(
toFile, //String
uri, //String
replaceVariables, //boolean
httpMethod, //String
contentType, //String
requestBody, //String
user, //String
pwd, //String
settings //Map
);

Details

ArgumentTypeDescription
toFileStringabsolute path including the file name, where the binary HTTP response will be saved
uriStringURI, expressed as http:// or https:// with or without variables, expressed as :XXX
replaceVariablesbooleanflag used to replace variables within the URI (variables are expressed as :XXX)
httpMethodString(optional: can be null); if specified, it defines the HTTP method: GET, POST
contentTypeString(optional: can be null); if specified, it defines the content type request (e.g. application/json)
requestBodyString(optional: can be null); if specified, it defines the request body, expressed as a String (e.g. JSON or XML content)
userString(optional: can be null); if specified, it defines the username for BASIC authentication
pwdString(optional: can be null); if specified, it defines the password for BASIC authentication
settingsMap(optional: can be null); additional settings map. Supported keys: (details below)

settings​

(optional: can be null); additional settings map. Supported keys:

  • "headers" (Map<String, String>) — custom HTTP request headers as key-value pairs

⚠️ Throws

  • Exception in case of connection, I/O, or authentication errors

getBinaryContent​

Execute an HTTP(s) connection and fetch the result, expresses as a binary content

Syntax

utils.getBinaryContent(
toFile, //String
uri, //String
replaceVariables, //boolean
httpMethod, //String
contentType, //String
requestBody, //String
user, //String
pwd //String
);

Details

ArgumentTypeDescription
toFileStringabsolute path including the file name, related to the local binary file to create and fill in with the result of this HTTP request
uriStringURI, expressed as http:// or https:// with or without variables, expressed as :XXX
replaceVariablesbooleanflag used to replace variables within the uri (variables are expressed as :XXX)
httpMethodString(optional: can be null); if specified, it defines the HTTP method: GET, POST
contentTypeString(optional: can be null); if specified, it defines the content type request (e.g. application/json)
requestBodyString(optional: can be null); if specified, it defines the request body, expressed as a String (e.g. a JSON or XML content)
userString(optional: can be null); if specified, it defines the username for a BASIC authentication
pwdString(optional: can be null); if specified, it defines the password for a BASIC authentication

✅ Returns

the HTTP response, expressed as a binary content

⚠️ Throws

  • Exception

getBinaryContent​

Execute an HTTP(s) connection and fetch the result, expresses as a binary content

Syntax

utils.getBinaryContent(
toFile, //String
uri, //String
replaceVariables, //boolean
httpMethod, //String
settings //Map
);

Details

ArgumentTypeDescription
toFileStringabsolute path including the file name, related to the local binary file to create and fill in with the result of this HTTP request
uriStringURI, expressed as http:// or https:// with or without variables, expressed as :XXX
replaceVariablesbooleanflag used to replace variables within the uri (variables are expressed as :XXX)
httpMethodString(optional: can be null); if specified, it defines the HTTP method: GET, POST
settingsMapmap containing HTTP request configuration. Supported keys: (details below)

settings​

map containing HTTP request configuration. Supported keys:

  • "contentType" (String) — the Content-Type header value (e.g. "application/json")
  • "requestBody" (String or byte[]) — the request body; can also be loaded from a file via "fromFile"
  • "user" (String) — username for HTTP BASIC authentication
  • "pwd" (String) — password for HTTP BASIC authentication
  • "headers" (Map<String, String>) — additional HTTP request headers
  • "fromFile" (String) — absolute path to a local file whose content will be used as requestBody (binary)
  • "log" (Boolean) — if false, suppresses request/response logging
  • "timeout" (Number) — connection and socket timeout in seconds

✅ Returns

the HTTP response, expressed as a binary content

⚠️ Throws

  • Exception

getBlobAsBase64​

Retrieves the content of a BLOB field as a Base64-encoded string.

Syntax

//return String type
var risp = utils.getBlobAsBase64(
datastoreId, //Long
sql, //String
params //Object[]
);

Details

ArgumentTypeDescription
datastoreIdLongoptional data source identifier; if null, the default is used
sqlStringSQL SELECT query that retrieves a single BLOB column
paramsObject[]bind variable values for the SQL query placeholders

✅ Returns

the BLOB content encoded as a Base64 string

⚠️ Throws

  • Throwable in case of errors

getByteDimensionOfString​

Calculates the byte size of a string using the platform's default charset encoding.

Syntax

//return long type
var risp = utils.getByteDimensionOfString(
s //String
);

Details

ArgumentTypeDescription
sStringthe string whose byte size is to be calculated

✅ Returns

the number of bytes the string occupies when encoded with the default charset


getCachedProgressive​

Retrieves the next progressive value using an in-memory cache to reduce database lock contention. When a progressives table is accessed concurrently at a very high rate, direct database updates for each increment cause locks and poor performance. This method caches a range of progressive values in memory, returning the next cached value without touching the database until the range is exhausted. Only when the cached range is consumed does it perform a database UPDATE to reserve the next range. If the record does not exist in the progressives table, it is automatically inserted with the specified initial value and fields.

Syntax

//return Long type
var risp = utils.getCachedProgressive(
settings //Map
);

Details

ArgumentTypeDescription
settingsMapa Map containing the progressive configuration with the following expected keys: (details below)

settings​

a Map containing the progressive configuration with the following expected keys:

  • datasourceId (Number, optional): data source identifier for the progressives table; if null, the default data source is used
  • tableName (String, required): name of the progressives table
  • pkFields (List, required): list of field names composing the primary key
  • pkValues (List, required): list of values for the PK fields (same order as pkFields)
  • updateFields (List, required): additional fields to update when incrementing the current value (e.g., USER_ID_UPDATE, LAST_UPDATE)
  • updateValues (List, required): values for the additional update fields
  • currentValueField (String, required): field name in the progressives table containing the current value
  • incrementValue (Number, required): how much to increase the current value on each database update (defines the size of the cached range)
  • initialValue (Number, required): initial value to set when inserting a new record because it was not found
  • insertFields (List, optional): list of fields to populate when inserting a new record (do NOT include currentValueField)
  • insertValues (List, optional): values for the insert fieldsExample: var settings = \{ datasourceId: null, tableName: "INI21_GLOBAL_SEQUENCES", pkFields: ["TABLE_NAME","FIELD_NAME"], pkValues: ["AAAA","PROG_ID"], updateFields: ["USER_ID_UPDATE","LAST_UPDATE"], updateValues: [userInfo.username, utils.getCurrentDateAndTime()], currentValueField: "CURRENT_VALUE", incrementValue: 2, initialValue: utils.getInitialValue(), insertFields: ["INITIAL_VALUE","INCREMENT_VALUE","IS_CYCLE","MAX_NUMBER","USER_ID_CREATE","CREATE_DATE","ROW_VERSION","STATUS"], insertValues: [utils.getInitialValue(), 2, "F", null, userInfo.username, utils.getCurrentDateAndTime(), 0, "E"] ; }

✅ Returns

the next progressive value (Long)

⚠️ Throws

  • Throwable if required settings keys are missing (tableName, pkFields, pkValues, updateFields, updateValues, currentValueField, incrementValue) or a database error occurs

getCatalog​

Retrieves the database catalog name for the specified datasource. Opens a direct JDBC connection to the datasource and returns the catalog name.

Syntax

//return String type
var risp = utils.getCatalog(
datasourceId //Long
);

Details

ArgumentTypeDescription
datasourceIdLongthe platform datasource identifier to connect to

✅ Returns

the catalog name associated with the JDBC connection, or null if not available

⚠️ Throws

  • Throwable if a connection or database access error occurs

getCellsValue​

Retrieves cell values and evaluates functions from an Excel (xlsx) file. Supports direct cell coordinate lookups and custom formula-like functions (e.g., sum, cellValue).

Syntax

//return Map type
var risp = utils.getCellsValue(
directoryId, //Long
fileName, //String
coordinates, //List
functions //List
);

Details

ArgumentTypeDescription
directoryIdLongthe platform directory identifier where the Excel file is located
fileNameStringthe name of the xlsx file to read
coordinatesLista list of objects specifying cell coordinates to read, each with structure: \{ sheetName: "Sheet1", cellCoordinate: "A3" }
functionsLista list of objects specifying functions to evaluate, each with structure: \{ sheetName: "Sheet1", function: "sum(cellValue(\"E4\"), cellValue(\"E8\"))" }

✅ Returns

a Map where keys are cell references in the format "SheetName!CellRef" (e.g., "Sheet1!A3") and values are the corresponding cell values (including intermediate values needed for function evaluation)

⚠️ Throws

  • Throwable if the file cannot be read or a processing error occurs

getCertMessageFromPdf​

Extracts the digital certificate message from a signed PDF file. The source PDF is read from the directory identified by srcDirectoryId, the certificate is extracted via the CertBean.getCertMessageFromPdf remote call, and the resulting document (without signature) is saved to the directory identified by destDirectoryId.

Syntax

//return Map type
var risp = utils.getCertMessageFromPdf(
srcDirectoryId, //Long
destDirectoryId, //Long
fileName //String
);

Details

ArgumentTypeDescription
srcDirectoryIdLongdirectory identifier where the source PDF is located
destDirectoryIdLongdirectory identifier where the output document will be saved
fileNameStringthe PDF file name (used in both source and destination directories)

✅ Returns

a Map containing the certificate message details extracted from the PDF

⚠️ Throws

  • Throwable in case of I/O or server communication errors

getCertMessage​

Read the specified file from the source directory and extract signed data and the embedded document. The embedded document is then saved in the destination directory.

Syntax

//return Map type
var risp = utils.getCertMessage(
srcDirectoryId, //Long
destDirectoryId, //Long
fileName //String
);

Details

ArgumentTypeDescription
srcDirectoryIdLongid used to identify a source folder in the server file system where the file to read has been stored
destDirectoryIdLongid used to identify the destination folder where the extracted embedded document will be saved.
fileNameStringfile name inside the specified folder

✅ Returns

signed data and the embedded document

⚠️ Throws

  • Throwable in case of errors

getCertMessage​

Read the specified file from the source directory and extract signed data and the embedded document. The embedded document is then saved in the destination directory.

Syntax

//return Map type
var risp = utils.getCertMessage(
srcFileName, //String
destFolder //String
);

Details

ArgumentTypeDescription
srcFileNameStringpath + file name to analyze
destFolderStringdestination folder; if not specified, the srcFolder will be used

✅ Returns

signed data and the embedded document

⚠️ Throws

  • Throwable in case of errors

getColumnsInQuery​

Syntax

//return String type
var risp = utils.getColumnsInQuery(
datastoreId, //Long
query //String
);

Details

ArgumentTypeDescription
datastoreIdLong
queryString

getColumnsInTable​

Syntax

//return String type
var risp = utils.getColumnsInTable(
datastoreId, //Long
tableName //String
);

Details

ArgumentTypeDescription
datastoreIdLong
tableNameStringString: name of table

getCompanyApplParameter​

Retrieves an application-specific parameter value for the given company and site.

Syntax

//return String type
var risp = utils.getCompanyApplParameter(
companyId, //String
siteId, //Long
paramId //String
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
paramIdStringthe parameter code identifier

✅ Returns

the parameter value as a String, or null if not found

⚠️ Throws

  • Throwable in case of server communication errors

getConversationFromTag​

Get the whole conversation (list of messages), starting from a tag included at some point in the conversation.

Syntax

//return Con60Logs[] type
var risp = utils.getConversationFromTag(
messageTag //String
);

Details

ArgumentTypeDescription
messageTagStringtag used to locate the conversation and return all messages belonging to it.

getConversation​

Get the whole conversation (list of messages), starting from the conversation id.

Syntax

//return Con60Logs[] type
var risp = utils.getConversation(
conversationId //Long
);

Details

ArgumentTypeDescription
conversationIdLongconversation identifier whose full message history must be retrieved.

getCount​

Gets the current count for the specified column in the given table and increments it by the given value. Useful for managing custom counters with filter conditions.

Syntax

//return Long type
var risp = utils.getCount(
tableName, //String
valueColumnName, //String
incrementValue, //String
where, //String
separatedTransaction, //Boolean
interruptExecution, //Boolean
dataSourceId //Long
);

Details

ArgumentTypeDescription
tableNameStringtable name containing the counter
valueColumnNameStringcolumn name that holds the counter value
incrementValueStringincrement value to apply to the counter
whereStringSQL WHERE clause to filter the counter record (e.g. "COMPANY_ID='00000'")
separatedTransactionBooleanif true, the operation is executed in a separate transaction
interruptExecutionBooleanif true, on error the execution is interrupted with rollback
dataSourceIdLongdata source identifier to use; if null, the default one is used

✅ Returns

the updated counter value

⚠️ Throws

  • Throwable in case of errors during the operation

getCount​

Gets the current count for the specified column in the given table and increments it by the given value. Useful for managing custom counters with filter conditions.

Syntax

//return Long type
var risp = utils.getCount(
tableName, //String
valueColumnName, //String
incrementValue, //String
where, //String
separatedTransaction, //Boolean
interruptExecution //Boolean
);

Details

ArgumentTypeDescription
tableNameStringtable name containing the counter
valueColumnNameStringcolumn name that holds the counter value
incrementValueStringincrement value to apply to the counter
whereStringSQL WHERE clause to filter the counter record (e.g. "COMPANY_ID='00000'")
separatedTransactionBooleanif true, the operation is executed in a separate transaction
interruptExecutionBooleanif true, on error the execution is interrupted with rollback

✅ Returns

the updated counter value

⚠️ Throws

  • Throwable in case of errors during the operation

getCsvContent​

Read up to the specified number of rows, starting from the specified index (0..x) from the csv file stored in the specified path and get back the content of a specific folder.

Syntax

//return Map[] type
var risp = utils.getCsvContent(
sep, //String
dirId, //String
fileName, //String
startRow, //Integer
blockSize, //Integer
removeEmptyValues, //Boolean
attributeNames //String[]
);

Details

ArgumentTypeDescription
sepStringtokens separator: ; or ,
dirIdStringpath identifier
fileNameStringname of the csv file
startRowIntegerrow index; if null it is the first row, i.e. 0
blockSizeIntegermax number of rows to read, if available; if null it is set to 10000
removeEmptyValuesBooleantrue to remove all empty values from the list; false to mantain them
attributeNamesString[]attribute names assigned to each CSV column from left to right when building the returned row maps.

✅ Returns

a list of js objects, where each object is expressed as a set of couples ; a 0 length list in case of no more rows available @parsm attributeNames, list of attributes, assigned to each column, starting from leftmost column to the right


getCurrentDateAndTime​

return the current timestamp @throws Throwable in case of errors

Syntax

//return Timestamp type
var risp = utils.getCurrentDateAndTime();

✅ Returns

the current timestamp

⚠️ Throws

  • Throwable in case of errors

getCurrentDate​

return the current date/time as a Date @throws Throwable in case of errors

Syntax

//return Date type
var risp = utils.getCurrentDate();

✅ Returns

the current date/time as a Date

⚠️ Throws

  • Throwable in case of errors

getCurrentTime​

return the current time @throws Throwable in case of errors

Syntax

//return Time type
var risp = utils.getCurrentTime();

✅ Returns

the current time

⚠️ Throws

  • Throwable in case of errors

getCustomApplUserVars​

Get a custom parameter from the user session.

Syntax

//return String type
var risp = utils.getCustomApplUserVars(
code //String
);

Details

ArgumentTypeDescription
codeStringcustom session-variable key whose value must be returned.

getCustomResource​

Retrieves a custom translated resource string for the given entry key from the application-specific translations (stored in CON32 table and custom .properties files). Unlike getResource which uses the standard i18n bundle, this method looks up application-specific custom translations that can be configured per application instance.

Syntax

//return String type
var risp = utils.getCustomResource(
entry //String
);

Details

ArgumentTypeDescription
entryStringthe resource key to look up

✅ Returns

the custom translated string, or the entry key itself if no custom translation is found or if the internal state is not available


getDataModelAttrTypes​

Syntax

//return String type
var risp = utils.getDataModelAttrTypes(
dataModelId //Long
);

Details

ArgumentTypeDescription
dataModelIdLongdata model id, used to compare the attribute value types

✅ Returns

json containing a list of : [{ "attrName": "...", "attrType": "..."},...]


getDataStoreId​

Syntax

//return Long type
var risp = utils.getDataStoreId(
dataStoreId //Long
);

Details

ArgumentTypeDescription
dataStoreIdLongdata store id to use (probably)

✅ Returns

real data store id to use, according to a specific routing rule


getDirectoryPath​

Syntax

//return String type
var risp = utils.getDirectoryPath(
directoryId //Long
);

Details

ArgumentTypeDescription
directoryIdLongdirectory identifier

✅ Returns

path path defined for the specified id; null if the specified id does not exist


getDriverNameDefaultConnection​

return driver name related to the default database connection

Syntax

//return String type
var risp = utils.getDriverNameDefaultConnection();

✅ Returns

driver name related to the default database connection


getEmailsWithSettings​

Read a list of messages from the email server.

Syntax

//return Object type
var risp = utils.getEmailsWithSettings(
server, //String
port, //Integer
username, //String
password, //String
protocol, //String
useTLS, //Boolean
maxMessagesToRead, //Integer
notReadFilter, //Boolean
startSendDateFilter, //Date
endSendDateFilter, //Date
startReceiveDateFilter, //Date
endReceiveDateFilter, //Date
fromAddressFilter, //String
subjectFilter, //String
bodyFilter, //String
withAttachments, //Boolean
attachmentsPath, //String
folderName, //String
moveToFolderOnceRead, //String
setAsSeen, //Boolean
deleteEmailWhenRead, //Boolean
debug, //Boolean
settings //Map
);

Details

ArgumentTypeDescription
serverStringserver host
portIntegerserver port
usernameStringusername to use when accessing the email server
passwordStringpassword to use when accessing the email server
protocolStringprotocol to use when connecting to the email server
useTLSBooleanflag used to enabled the TLS mode
maxMessagesToReadIntegermaximum number of messages to read
notReadFilterBooleanflag used to filter only messages not read yet
startSendDateFilterDateoptional parameter; if not null, messages to read will be filtered by sending date: only the ones next or equal to this date wil be returned
endSendDateFilterDateoptional parameter; if not null, messages to read will be filtered by sending date: only the ones previous or equal to this date wil be returned
startReceiveDateFilterDateoptional parameter; if not null, messages to read will be filtered by receiving date: only the ones next or equal to this date wil be returned
endReceiveDateFilterDateoptional parameter; if not null, messages to read will be filtered by receiving date: only the ones previous or equal to this date wil be returned
fromAddressFilterStringoptional parameter; if not null, messages to read will be filtered by the "from address" specified
subjectFilterStringoptional parameter; if not null, messages to read will be filtered and only the ones containing this value in their object will be returned
bodyFilterStringoptional parameter; if not null, messages to read will be filtered and only the ones containing this value in their body content will be returned
withAttachmentsBooleanoptional parameter; if not null, messages to read will be filtered and only the ones having at least one attachment will be returned
attachmentsPathStringabsolute path where saving attachments
folderNameStringfolder to read; e.g. INBOX; if not specified, it will be set to INBOX
moveToFolderOnceReadStringmove to the specified folder each message, once read; can be null
setAsSeenBooleanflag used to mark as "SEEN" a message just read
deleteEmailWhenReadBooleanflag used to delete the email message once read
debugBooleanflag used to debug the communication with the server
settingsMapoptional additional mail-reader settings forwarded unchanged to ReceiveEmailBean as a HashMap copy; use it for provider-specific JavaMail/store properties or other mailbox-reading options supported by that bean.

✅ Returns

list of messages found in the email server, filtered according to the specified filter values Attributes contained in each message of the list: id - email identified, used to delete an email message later from - from email addresss message - email body subject - email subject mimeType - e.g. "text/plain" or "text/html" list attachments - list of absolute paths where the attachments have been saved


getEmails​

Read a list of messages from the email server.

Syntax

//return Object type
var risp = utils.getEmails(
server, //String
port, //Integer
username, //String
password, //String
protocol, //String
useTLS, //Boolean
maxMessagesToRead, //Integer
notReadFilter, //Boolean
startDateFilter, //Date
fromAddressFilter, //String
subjectFilter, //String
bodyFilter, //String
withAttachments, //Boolean
attachmentsPath, //String
folderName, //String
moveToFolderOnceRead, //String
setAsSeen, //Boolean
deleteEmailWhenRead, //Boolean
debug //Boolean
);

Details

ArgumentTypeDescription
serverStringserver host
portIntegerserver port
usernameStringusername to use when accessing the email server
passwordStringpassword to use when accessing the email server
protocolStringprotocol to use when connecting to the email server
useTLSBooleanflag used to enabled the TLS mode
maxMessagesToReadIntegermaximum number of messages to read
notReadFilterBooleanflag used to filter only messages not read yet
startDateFilterDateoptional parameter; if not null, messages to read will be filtered by send date: only the ones next or equal to this date wil be returned
fromAddressFilterStringoptional parameter; if not null, messages to read will be filtered by the "from address" specified
subjectFilterStringoptional parameter; if not null, messages to read will be filtered and only the ones containing this value in their object will be returned
bodyFilterStringoptional parameter; if not null, messages to read will be filtered and only the ones containing this value in their body content will be returned
withAttachmentsBooleanoptional parameter; if not null, messages to read will be filtered and only the ones having at least one attachment will be returned
attachmentsPathStringabsolute path where saving attachments
folderNameStringfolder to read; e.g. INBOX; if not specified, it will be set to INBOX
moveToFolderOnceReadStringmove to the specified folder each message, once read; can be null
setAsSeenBooleanflag used to mark as "SEEN" a message just read
deleteEmailWhenReadBooleanflag used to delete the email message once read
debugBooleanflag used to debug the communication with the server

✅ Returns

list of messages found in the email server, filtered according to the specified filter values Attributes contained in each message of the list: id - email identified, used to delete an email message later from - from email addresss message - email body subject - email subject mimeType - e.g. "text/plain" or "text/html" list attachments - list of absolute paths where the attachments have been saved


getEmails​

Read a list of messages from the email server.

Syntax

//return Object type
var risp = utils.getEmails(
server, //String
port, //Integer
username, //String
password, //String
protocol, //String
useTLS, //Boolean
maxMessagesToRead, //Integer
notReadFilter, //Boolean
startSendDateFilter, //Date
endSendDateFilter, //Date
startReceiveDateFilter, //Date
endReceiveDateFilter, //Date
fromAddressFilter, //String
subjectFilter, //String
bodyFilter, //String
withAttachments, //Boolean
attachmentsPath, //String
folderName, //String
moveToFolderOnceRead, //String
setAsSeen, //Boolean
deleteEmailWhenRead, //Boolean
debug //Boolean
);

Details

ArgumentTypeDescription
serverStringserver host
portIntegerserver port
usernameStringusername to use when accessing the email server
passwordStringpassword to use when accessing the email server
protocolStringprotocol to use when connecting to the email server
useTLSBooleanflag used to enabled the TLS mode
maxMessagesToReadIntegermaximum number of messages to read
notReadFilterBooleanflag used to filter only messages not read yet
startSendDateFilterDateoptional parameter; if not null, messages to read will be filtered by sending date: only the ones next or equal to this date wil be returned
endSendDateFilterDateoptional parameter; if not null, messages to read will be filtered by sending date: only the ones previous or equal to this date wil be returned
startReceiveDateFilterDateoptional parameter; if not null, messages to read will be filtered by receiving date: only the ones next or equal to this date wil be returned
endReceiveDateFilterDateoptional parameter; if not null, messages to read will be filtered by receiving date: only the ones previous or equal to this date wil be returned
fromAddressFilterStringoptional parameter; if not null, messages to read will be filtered by the "from address" specified
subjectFilterStringoptional parameter; if not null, messages to read will be filtered and only the ones containing this value in their object will be returned
bodyFilterStringoptional parameter; if not null, messages to read will be filtered and only the ones containing this value in their body content will be returned
withAttachmentsBooleanoptional parameter; if not null, messages to read will be filtered and only the ones having at least one attachment will be returned
attachmentsPathStringabsolute path where saving attachments
folderNameStringfolder to read; e.g. INBOX; if not specified, it will be set to INBOX
moveToFolderOnceReadStringmove to the specified folder each message, once read; can be null
setAsSeenBooleanflag used to mark as "SEEN" a message just read
deleteEmailWhenReadBooleanflag used to delete the email message once read
debugBooleanflag used to debug the communication with the server

✅ Returns

list of messages found in the email server, filtered according to the specified filter values Attributes contained in each message of the list: id - email identified, used to delete an email message later from - from email addresss message - email body subject - email subject mimeType - e.g. "text/plain" or "text/html" list attachments - list of absolute paths where the attachments have been saved


getEncToken​

Encript a token.

Syntax

//return String type
var risp = utils.getEncToken(
pars //String[]
);

Details

ArgumentTypeDescription
parsString[]token parts to encrypt; the varargs elements are concatenated/processed by the utility to produce a single encrypted token

✅ Returns

encripted token


getEncodedRtk​

Encodes the provided parameters into a Base64-encoded RTK (authentication token) string containing credentials information.

Syntax

//return String type
var risp = utils.getEncodedRtk(
pars //String[]
);

Details

ArgumentTypeDescription
parsString[]variable arguments representing the parameters to encode (typically: companyId, siteId, username, password)

✅ Returns

the Base64-encoded RTK string

⚠️ Throws

  • Exception in case of encoding errors

getEntriesList​

Get a list of records read from the LDAP server, where each record is expressed as a Javascript object.

Syntax

//return Map[] type
var risp = utils.getEntriesList(
host, //String
port, //Integer
baseDN, //String
ldapUsername, //String
ldapPassword, //String
searchAttributes, //String
attributesListToRead //String>
);

Details

ArgumentTypeDescription
hostStringLDAP host
portIntegerLDAP port (optional: if not specified, 389 will be used)
baseDNStringbase DN to apply as a filter
ldapUsernameStringusername to use to authenticate to the LDAP server
ldapPasswordStringpassword to use to authenticate to the LDAP server
searchAttributesStringattributes to apply as a filter
attributesListToReadString>list of attribute names to take into account when reading records from the LDAP server: these will be the only ones to use when creating the JSON result

✅ Returns

list of records read from the LDAP server, where each record is expressed as a Javascript object


getEnvironment​

return the environment identifier string, or null if not configured

Syntax

//return String type
var risp = utils.getEnvironment();

✅ Returns

the environment identifier string, or null if not configured


getExcelRowsBlock​

Reads a block of rows from an Excel file (xls or xlsx) and returns them as an array of Maps. Each Map represents a row, with keys being the attribute names provided and values being the cell contents.

Syntax

//return Map[] type
var risp = utils.getExcelRowsBlock(
dirId, //Long
fileName, //String
sheetIndex, //Long
fromRow, //Long
toRow, //Long
attributeNames //String[]
);

Details

ArgumentTypeDescription
dirIdLongthe platform directory identifier where the Excel file is located
fileNameStringthe name of the Excel file to read
sheetIndexLongthe 1-based sheet index to read from (1, 2, 3...); defaults to 1 if null
fromRowLongthe 1-based starting row number (1, 2, 3...); defaults to 1 if null
toRowLongthe 1-based ending row number (inclusive); defaults to fromRow + 10000 if null
attributeNamesString[]the names to assign to each column in the result Maps (positional mapping)

✅ Returns

an array of Maps, one per row, where each Map has attribute names as keys and cell values as values

⚠️ Throws

  • Throwable if toRow is less than fromRow, if no attribute names are provided, or if a server/file error occurs

getFileLength​

Returns the length (in bytes) of the file identified by the given absolute path. If the file does not exist or is a directory, the return value is platform-dependent (typically 0L for non-existent files).

Syntax

//return long type
var risp = utils.getFileLength(
fileAbsolutePath //String
);

Details

ArgumentTypeDescription
fileAbsolutePathStringthe absolute path to the file whose length is to be determined

✅ Returns

the length of the file in bytes, or 0L if the file does not exist


getFile [Deprecated]​

Download a file from the FTP server and store it in the specified LOCAL folder.

Syntax

//return boolean type
var risp = utils.getFile(
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
ftpDir, //String
ftpFileName, //String
localFile //String
);

Details

ArgumentTypeDescription
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
ftpDirStringfolder in the FTP server where the file to download resides
ftpFileNameStringfile name in the FTP sever to download
localFileStringfolder+file name in the local file system where storing the downloaded file

✅ Returns

true if the file stored within the FTP server has been downloaded correctly


getFile​

Download a file from the FTP server and store it in the specified LOCAL folder.

Syntax

//return boolean type
var risp = utils.getFile(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
ftpDir, //String
ftpFileName, //String
localFile, //String
sessionTimeout, //Integer
charset //String
);

Details

ArgumentTypeDescription
protocolStringthe FTP protocol type (e.g. "FTP", "FTPS", "SFTP")
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
ftpDirStringfolder in the FTP server where the file to download resides
ftpFileNameStringfile name in the FTP sever to download
localFileStringfolder+file name in the local file system where storing the downloaded file
sessionTimeoutIntegerseconds of timeout for the FTP session (nullable)
charsetStringcharset to use when writing the local file (e.g. "UTF-8", "ISO-8859-1")

✅ Returns

true if the file stored within the FTP server has been downloaded correctly


getFile​

Download a file from the FTP server and store it in the specified LOCAL folder.

Syntax

//return boolean type
var risp = utils.getFile(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
ftpDir, //String
ftpFileName, //String
localFile, //String
sessionTimeout //Integer
);

Details

ArgumentTypeDescription
protocolStringthe FTP protocol type (e.g. "FTP", "FTPS", "SFTP")
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
ftpDirStringfolder in the FTP server where the file to download resides
ftpFileNameStringfile name in the FTP sever to download
localFileStringfolder+file name in the local file system where storing the downloaded file
sessionTimeoutIntegerseconds of timeout for the FTP session (nullable)

✅ Returns

true if the file stored within the FTP server has been downloaded correctly


getFile​

Download a file from the FTP server and store it in the specified LOCAL folder.

Syntax

//return boolean type
var risp = utils.getFile(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
ftpDir, //String
ftpFileName, //String
localFile //String
);

Details

ArgumentTypeDescription
protocolStringthe FTP protocol type (e.g. "FTP", "FTPS", "SFTP")
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
ftpDirStringfolder in the FTP server where the file to download resides
ftpFileNameStringfile name in the FTP sever to download
localFileStringfolder+file name in the local file system where storing the downloaded file

✅ Returns

true if the file stored within the FTP server has been downloaded correctly


getFilesInPath​

Syntax

//return String[] type
var risp = utils.getFilesInPath(
path //String
);

Details

ArgumentTypeDescription
pathStringabsolute path

✅ Returns

list of file names in the specified path; directories are ignored


getFiles​

Get a folder content in the FTP server, filtered according to the specified filter.

Syntax

//return String[] type
var risp = utils.getFiles(
dirId //Long
);

Details

ArgumentTypeDescription
dirIdLongdirectory id

✅ Returns

list of file names; subfolders will be ignored


getFiles [Deprecated]​

Get a folder content in the FTP server, filtered according to the specified filter.

Syntax

//return String[] type
var risp = utils.getFiles(
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
remoteDir, //String
fileFilter //String
);

Details

ArgumentTypeDescription
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
remoteDirStringfolder in the FTP server to read
fileFilterString(optional) parameter to use to filter files to read (e.g. .jpg)

✅ Returns

list of file names; subfolders will be ignored


getFiles​

Get a folder content in the FTP server, filtered according to the specified filter.

Syntax

//return String[] type
var risp = utils.getFiles(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
remoteDir, //String
fileFilter, //String
sessionTimeout //Integer
);

Details

ArgumentTypeDescription
protocolStringFTP protocol type to use for the connection, for example FTP, FTPS, or SFTP.
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
remoteDirStringfolder in the FTP server to read
fileFilterString(optional) parameter to use to filter files to read (e.g. .jpg)
sessionTimeoutIntegerseconds of timeout session

✅ Returns

list of file names; subfolders will be ignored


getFiles​

Get a folder content in the FTP server, filtered according to the specified filter.

Syntax

//return String[] type
var risp = utils.getFiles(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
remoteDir, //String
fileFilter //String
);

Details

ArgumentTypeDescription
protocolStringFTP protocol type to use for the connection, for example FTP, FTPS, or SFTP.
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
remoteDirStringfolder in the FTP server to read
fileFilterString(optional) parameter to use to filter files to read (e.g. .jpg)

✅ Returns

list of file names; subfolders will be ignored


getFilterField​

Builds a SQL WHERE clause fragment for a single filter attribute, mapping the attribute name to the specified database field name. If the filter is active for the given attribute, returns a clause like "TMP.ITEM_CODE like ?". Example: given attrName = "itemCode" and fieldName = "TMP.ITEM_CODE", the result would be "TMP.ITEM_CODE like ?" if the user has filtered on "itemCode".

Syntax

//return String type
var risp = utils.getFilterField(
attrName, //String
fieldName //String
);

Details

ArgumentTypeDescription
attrNameStringthe filter attribute name as defined in the grid/panel
fieldNameStringthe fully-qualified database column name to use in the WHERE clause

✅ Returns

a SQL WHERE clause fragment with ? placeholder, or an empty string if the filter is not active


getFilterParam​

Retrieves the filter parameter value for a single attribute from the current grid filter conditions. Returns the value the user entered for the specified filter attribute, suitable for use as a PreparedStatement bind parameter. Example: given attrName = "itemCode" and fieldName = "TMP.ITEM_CODE", if the user filtered "itemCode" = "ABC", the result would be "ABC". Numeric values are returned as BigDecimal when parseable.

Syntax

//return Object type
var risp = utils.getFilterParam(
attrName, //String
fieldName //String
);

Details

ArgumentTypeDescription
attrNameStringthe filter attribute name as defined in the grid/panel
fieldNameStringthe fully-qualified database column name (used for matching context)

✅ Returns

the filter value (as BigDecimal if numeric, otherwise as-is), or null if no filter is active for this attribute


getFilterParams​

Extracts the filter parameter values corresponding to the active filter conditions, for use as bind parameters in a SQL WHERE clause generated by getFilterWhere. Only includes values for filters whose attribute names are present in the provided map. Example: given attributes = \{ itemCode: "TMP.ITEM_CODE", barcode: "TMP.BARCODE" }, if the user has filtered "itemCode" = "ABC" and "barcode" = 2, the result would be ["ABC", 2].

Syntax

//return Object[] type
var risp = utils.getFilterParams(
attributes //Map
);

Details

ArgumentTypeDescription
attributesMapa Map where keys are the filter attribute names (as defined in the grid/panel) and values are the corresponding fully-qualified database column names

✅ Returns

an array of filter values in the same order as the WHERE clause conditions, suitable for use as PreparedStatement bind parameters


getFilterWhere​

Builds a SQL WHERE clause fragment from the current grid filter conditions, mapping filter attribute names to the corresponding database table field names. Only includes filter clauses whose attribute names are present in the provided map. Example: given attributes = \{ itemCode: "TMP.ITEM_CODE", barcode: "TMP.BARCODE" }, if the user has filtered on "itemCode" with a LIKE operator, the result would be "TMP.ITEM_CODE like ? AND TMP.BARCODE = ?".

Syntax

//return String type
var risp = utils.getFilterWhere(
attributes //Map
);

Details

ArgumentTypeDescription
attributesMapa Map where keys are the filter attribute names (as defined in the grid/panel) and values are the corresponding fully-qualified database column names (e.g., "TABLE.COLUMN_NAME")

✅ Returns

a SQL WHERE clause fragment with ? placeholders for parameter binding, or an empty string if no matching filters are active


getHtmlElements​

Fetches the HTML content from the specified URL and parses it into a Jsoup Document object. The returned Document can be used to navigate and extract elements using CSS selectors.

Syntax

//return Document type
var risp = utils.getHtmlElements(
url //String
);

Details

ArgumentTypeDescription
urlStringthe URL to fetch HTML content from (must be a valid HTTP or HTTPS URL)

✅ Returns

the parsed Document representing the HTML structure, or null if the connection fails or an error occurs


getHttpResponseCode​

return the HTTP status code (default is 200)

Syntax

//return int type
var risp = utils.getHttpResponseCode();

✅ Returns

the HTTP status code (default is 200)


getInitialValue​

return initial value for counters

Syntax

//return Long type
var risp = utils.getInitialValue();

✅ Returns

initial value for counters


getJSONList​

Convert a list of javascript objects into its JSON representation: [...]

Syntax

//return String type
var risp = utils.getJSONList(
aux //Map[]
);

Details

ArgumentTypeDescription
auxMap[]array of Map objects to convert to JSON format; each Map represents a JavaScript object and is serialized via getJSONObject(Map)

✅ Returns

a JSON representation of a list of objects Note: this result is NOT compatible with an Ext.grid.GridPanel data protocol: see getListResponse instead


getJSONObject [Deprecated]​

Convert a javascript object to its JSON representation

Syntax

//return String type
var risp = utils.getJSONObject(
obj //Map
);

Details

ArgumentTypeDescription
objMapjavascript object to convert to its JSON representation

✅ Returns

JSON representation


getJSONString​

Convert a javascript object to its JSON representation

Syntax

//return String type
var risp = utils.getJSONString(
obj //Map
);

Details

ArgumentTypeDescription
objMapjavascript object to convert to its JSON representation

✅ Returns

JSON representation


getLanguageIdFromEmail​

Get language id for the user identified by the specified email.

Syntax

//return String type
var risp = utils.getLanguageIdFromEmail(
email //String
);

Details

ArgumentTypeDescription
emailStringemail to use when getting the user

✅ Returns

language id linked to the user


getLanguageIdFromUsername​

Get language id for the user identified by the specified username.

Syntax

//return String type
var risp = utils.getLanguageIdFromUsername(
username //String
);

Details

ArgumentTypeDescription
usernameStringusername to use when getting the user

✅ Returns

language id linked to the user


getListResponse​

Convert a list of javascript objects into its JSON representation: [...] and embed it to a "Ext.grid.GridPanel like" data representation, based on "valueObjectList", "resultSetLength" and "moreRows" attributes.

Syntax

//return String type
var risp = utils.getListResponse(
list, //Map[]
resultSetLength, //Number
moreRows //Boolean
);

Details

ArgumentTypeDescription
listMap[]list of javascript objects to convert to JSON format
resultSetLengthNumberlist of objects (can be list.length)
moreRowsBooleanflag used to specify

✅ Returns

a JSON content compatible with Ext grids


getMappedPartialResultWithFieldsToInclude​

Starting from a MAPPER type data model, execute a SQL query using a custom SELECT clause (passed as argument) combined with the FROM clause defined through the data model mapping, and the WHERE, ORDER BY, GROUP BY and HAVING clauses specified here. Unlike getMappedPartialResultWithFieldsToOmit, this method allows the caller to explicitly specify which fields to include in the SELECT rather than removing from the default set. This base SQL query is then enriched by adding filtering/sorting conditions defined through a ListCommand object coming from the HTTP request. The ListCommand also contains pagination settings.

Syntax

//return String type
var risp = utils.getMappedPartialResultWithFieldsToInclude(
select, //String
where, //String
groupBy, //String
having, //String
orderBy, //String
dataModelId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
attributesMap, //String>
totalCount, //Long
pars //Object[]
);

Details

ArgumentTypeDescription
selectStringthe custom SELECT clause to use instead of the data model's default (DO NOT include the SELECT keyword)
whereStringoptional argument: if filled in, it represents the WHERE condition to append to the base SQL query (DO NOT specify the WHERE keyword)
groupByStringoptional argument: if filled in, it represents the GROUP BY condition to append to the base SQL query (DO NOT specify the GROUP BY keyword)
havingStringoptional argument: if filled in, it represents the HAVING condition to append to the base SQL query (DO NOT specify the HAVING keyword)
orderByStringoptional argument: if filled in, it represents the ORDER BY condition to append to the base SQL query (DO NOT specify the ORDER BY keyword)
dataModelIdLongrequired data model id, which must have a MAPPER type
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
attributesMapString>a map of attribute name to SQL type (as String), used to override the default type detection for specific columns when building filter conditions; can be null
totalCountLongif null, a COUNT() query is automatically executed; if provided, this value is used directly as the total row count, skipping the count query
parsObject[]optional bind parameters for the SQL query (can be expressed as [] in JavaScript), corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

a JSON string containing "valueObjectList" (array of row objects), "moreRows" (boolean indicating if more pages exist), and "resultSetLength" (total row count)

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true
  • RuntimeException if the specified dataModelId is invalid or does not reference a MAPPER type data model

getMappedPartialResultWithFieldsToOmit​

Starting from a MAPPER type data model, execute a SQL query automatically generated from the SELECT clause defined through the data model mapping, with specific fields removed according to the fieldsToOmit array, combined with the FROM clause from the mapping and the WHERE, ORDER BY, GROUP BY and HAVING clauses specified here. This base SQL query is then enriched by adding filtering/sorting conditions defined through a ListCommand object coming from the HTTP request. The ListCommand also contains pagination settings.

Syntax

//return String type
var risp = utils.getMappedPartialResultWithFieldsToOmit(
where, //String
groupBy, //String
having, //String
orderBy, //String
dataModelId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
attributesMap, //String>
totalCount, //Long
fieldsToOmit, //String[]
pars //Object[]
);

Details

ArgumentTypeDescription
whereStringoptional argument: if filled in, it represents the WHERE condition to append to the base SQL query (DO NOT specify the WHERE keyword)
groupByStringoptional argument: if filled in, it represents the GROUP BY condition to append to the base SQL query (DO NOT specify the GROUP BY keyword)
havingStringoptional argument: if filled in, it represents the HAVING condition to append to the base SQL query (DO NOT specify the HAVING keyword)
orderByStringoptional argument: if filled in, it represents the ORDER BY condition to append to the base SQL query (DO NOT specify the ORDER BY keyword)
dataModelIdLongrequired data model id, which must have a MAPPER type
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
attributesMapString>a map of attribute name to SQL type (as String), used to override the default type detection for specific columns when building filter conditions; can be null
totalCountLongif null, a COUNT() query is automatically executed; if provided, this value is used directly as the total row count, skipping the count query
fieldsToOmitString[]array of field names to remove from the data model's default SELECT clause; each entry must match exactly a column name/alias in the SELECT
parsObject[]optional bind parameters for the SQL query (can be expressed as [] in JavaScript), corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

a JSON string containing "valueObjectList" (array of row objects), "moreRows" (boolean indicating if more pages exist), and "resultSetLength" (total row count)

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true
  • RuntimeException if the specified dataModelId is invalid or does not reference a MAPPER type data model

getMappedPartialResult​

Starting from a MAPPER type data model, execute a SQL query automatically generated from the SELECT and FROM clauses defined through a mapping to a specific data source id (inherited at application level), combined with the WHERE, ORDER BY, GROUP BY and HAVING clauses specified here. This base SQL query is then enriched by adding filtering/sorting conditions defined through a ListCommand object coming from the HTTP request. The ListCommand also contains pagination settings. Mapped field aliases from the data model are automatically registered in the decodedFields map, allowing grid filter attributes to be correctly translated to actual table.field references.

Syntax

//return String type
var risp = utils.getMappedPartialResult(
where, //String
groupBy, //String
having, //String
orderBy, //String
dataModelId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
attributesMap, //String>
totalCount, //Long
pars //Object[]
);

Details

ArgumentTypeDescription
whereStringoptional argument: if filled in, it represents the WHERE condition to append to the base SQL query (DO NOT specify the WHERE keyword)
groupByStringoptional argument: if filled in, it represents the GROUP BY condition to append to the base SQL query (DO NOT specify the GROUP BY keyword)
havingStringoptional argument: if filled in, it represents the HAVING condition to append to the base SQL query (DO NOT specify the HAVING keyword)
orderByStringoptional argument: if filled in, it represents the ORDER BY condition to append to the base SQL query (DO NOT specify the ORDER BY keyword)
dataModelIdLongrequired data model id, which must have a MAPPER type
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
attributesMapString>a map of attribute name to SQL type (as String), used to override the default type detection for specific columns when building filter conditions; can be null
totalCountLongif null, a COUNT() query is automatically executed; if provided, this value is used directly as the total row count, skipping the count query
parsObject[]optional bind parameters for the SQL query (can be expressed as [] in JavaScript), corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

a JSON string containing "valueObjectList" (array of row objects), "moreRows" (boolean indicating if more pages exist), and "resultSetLength" (total row count)

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true
  • RuntimeException if the specified dataModelId is invalid or does not reference a MAPPER type data model

getMimeType​

Detects the MIME type of a file based on its file extension.

Syntax

//return String type
var risp = utils.getMimeType(
filename //String
);

Details

ArgumentTypeDescription
filenameStringthe file name or path to probe

✅ Returns

the detected MIME type (e.g. "application/pdf", "image/png"), or null if unknown

⚠️ Throws

  • IOException in case of errors during MIME type detection

getMultipleValuesList​

Get a list of Strings, related to multiple attribute values, starting from a specified attribute name of a specific entry read from the LDAP server.

Syntax

//return String[] type
var risp = utils.getMultipleValuesList(
host, //String
port, //Integer
baseDN, //String
ldapUsername, //String
ldapPassword, //String
searchAttributes, //String
attributeName //String
);

Details

ArgumentTypeDescription
hostStringLDAP host
portIntegerLDAP port (optional: if not specified, 389 will be used)
baseDNStringbase DN to apply as a filter
ldapUsernameStringusername to use to authenticate to the LDAP server
ldapPasswordStringpassword to use to authenticate to the LDAP server
searchAttributesStringattributes to apply as a filter
attributeNameStringattribute name to read: each matching found will generate a row in the results list

getObjectTime​

Creates a Time object from the specified hours, minutes, and seconds.

Syntax

//return Time type
var risp = utils.getObjectTime(
hours, //int
minutes, //int
seconds //int
);

Details

ArgumentTypeDescription
hoursintthe hour value (0-23)
minutesintthe minute value (0-59)
secondsintthe second value (0-59)

✅ Returns

the constructed Time object

⚠️ Throws

  • Throwable in case of errors

getPDFOrientation​

Determines the orientation of the first page in the PDF document by comparing the page width and height from its media box.

Syntax

//return String type
var risp = utils.getPDFOrientation(
uuid //String
);

Details

ArgumentTypeDescription
uuidStringthe output stream identifier returned by Long, Map)

✅ Returns

"portrait" if height > width, "landscape" otherwise

⚠️ Throws

  • Throwable if the document cannot be accessed
  • RuntimeException if the PDF file has not been opened (uuid not found)

getPDFPageCount​

Returns the total number of pages in the PDF document.

Syntax

//return int type
var risp = utils.getPDFPageCount(
uuid //String
);

Details

ArgumentTypeDescription
uuidStringthe output stream identifier returned by Long, Map)

✅ Returns

the total page count of the document

⚠️ Throws

  • Throwable if the document cannot be accessed
  • RuntimeException if the PDF file has not been opened (uuid not found)

getParameter​

Syntax

//return String type
var risp = utils.getParameter(
paramName //String
);

Details

ArgumentTypeDescription
paramNameStringa string value representing a parameter named defined at installation level (CON44 table) or at application level (CON07 table). If none of them are defined, the parameter is searched in the user application parameters list.

✅ Returns

the value defined for the specified parameter name or null if not found; if the parameter is found as an application parameter, that value is returned, otherwise it will be returned the value defined at installation level; If none of them are defined, the parameter is searched in the user application parameters list


getPartialResultNoCount​

Execute the specified SQL query and enrich it by adding filtering/sorting conditions defined through the ListCommand object, without executing an additional COUNT() query to determine the total result set length. Instead, the provided totalCount value is used directly. This variant improves performance when the total row count is already known or when counting is expensive.

Syntax

//return String type
var risp = utils.getPartialResultNoCount(
sql, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
totalCount, //Long
pars //Object[]
);

Details

ArgumentTypeDescription
sqlStringthe base SQL SELECT query to which filtering/sorting/pagination will be applied
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
totalCountLongthe pre-computed total row count to use in the response; avoids executing a COUNT() query
parsObject[]optional bind parameters for the SQL query (can be expressed as [] in JavaScript), corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

a JSON string containing "valueObjectList" (array of row objects), "moreRows" (boolean indicating if more pages exist), and "resultSetLength" (the provided totalCount)

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true

getPartialResultNoCount​

Execute the specified SQL query and enrich it by adding filtering/sorting conditions defined through the ListCommand object, without executing an additional COUNT() query to determine the total result set length. Instead, the provided totalCount value is used directly. This variant improves performance when the total row count is already known or when counting is expensive.

Syntax

//return String type
var risp = utils.getPartialResultNoCount(
select, //String
from, //String
where, //String
orderBy, //String
groupBy, //String
having, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
totalCount, //Long
pars //Object[]
);

Details

ArgumentTypeDescription
selectStringSELECT clause to execute, without the FROM keyword.
fromStringFROM clause, including tables, joins, and aliases.
whereStringoptional WHERE clause to apply before dynamic list-command filters are appended.
orderByStringoptional ORDER BY clause used as the base sorting before list-command sorting is applied.
groupByStringoptional GROUP BY clause.
havingStringoptional HAVING clause used together with groupBy.
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
totalCountLongthe pre-computed total row count to use in the response; avoids executing a COUNT() query
parsObject[]optional bind parameters for the SQL query (can be expressed as [] in JavaScript), corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

a JSON string containing "valueObjectList" (array of row objects), "moreRows" (boolean indicating if more pages exist), and "resultSetLength" (the provided totalCount)

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true

getPartialResult​

Execute the specified SQL query and enrich it by adding filtering/sorting conditions defined through the ListCommand object. The ListCommand contains pagination settings (page number, page size) as well as filter/sort criteria coming from the HTTP request (typically from a grid component). The decoded fields map (populated via setDecodeField) is applied to translate grid attribute names to actual table.field references in the generated WHERE/ORDER BY clauses.

Syntax

//return String type
var risp = utils.getPartialResult(
sql, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pars //Object[]
);

Details

ArgumentTypeDescription
sqlStringthe base SQL SELECT query to which filtering/sorting/pagination will be applied
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
parsObject[]optional bind parameters for the SQL query (can be expressed as [] in JavaScript), corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

a JSON string containing "valueObjectList" (array of row objects), "moreRows" (boolean indicating if more pages exist), and "resultSetLength" (total row count)

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true

getPartialResult​

Execute the specified SQL query and enrich it by adding filtering/sorting conditions defined through the ListCommand object. The ListCommand contains pagination settings (page number, page size) as well as filter/sort criteria coming from the HTTP request (typically from a grid component). The decoded fields map (populated via setDecodeField) is applied to translate grid attribute names to actual table.field references in the generated WHERE/ORDER BY clauses.

Syntax

//return String type
var risp = utils.getPartialResult(
sql, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
attributesMap, //String>
pars //Object[]
);

Details

ArgumentTypeDescription
sqlStringthe base SQL SELECT query to which filtering/sorting/pagination will be applied
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
attributesMapString>a map of attribute name to SQL type (as String), used to override the default type detection for specific columns when building filter conditions (e.g., forcing a column to be treated as a date or numeric type)
parsObject[]optional bind parameters for the SQL query (can be expressed as [] in JavaScript), corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

a JSON string containing "valueObjectList" (array of row objects), "moreRows" (boolean indicating if more pages exist), and "resultSetLength" (total row count)

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true

getPartialResult​

Execute the specified SQL query and enrich it by adding filtering/sorting conditions defined through the ListCommand object. The ListCommand contains pagination settings (page number, page size) as well as filter/sort criteria coming from the HTTP request (typically from a grid component). The decoded fields map (populated via setDecodeField) is applied to translate grid attribute names to actual table.field references in the generated WHERE/ORDER BY clauses.

Syntax

//return String type
var risp = utils.getPartialResult(
select, //String
from, //String
where, //String
orderBy, //String
groupBy, //String
having, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pars //Object[]
);

Details

ArgumentTypeDescription
selectStringSELECT clause to execute, without the FROM keyword.
fromStringFROM clause, including tables, joins, and aliases.
whereStringoptional WHERE clause to apply before dynamic list-command filters are appended.
orderByStringoptional ORDER BY clause used as the base sorting before list-command sorting is applied.
groupByStringoptional GROUP BY clause.
havingStringoptional HAVING clause used together with groupBy.
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
parsObject[]optional bind parameters for the SQL query (can be expressed as [] in JavaScript), corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

a JSON string containing "valueObjectList" (array of row objects), "moreRows" (boolean indicating if more pages exist), and "resultSetLength" (total row count)

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true

getPrintServices​

return an array of printer names available on the system

Syntax

//return String[] type
var risp = utils.getPrintServices();

✅ Returns

an array of printer names available on the system


getProgressiveForApplicationId​

Obtains the next progressive value for the specified column in the given table, using a different application ID than the current one.

Syntax

//return Long type
var risp = utils.getProgressiveForApplicationId(
appId, //String
tableName, //String
columnName, //String
separatedTransaction, //Boolean
interruptExecution //Boolean
);

Details

ArgumentTypeDescription
appIdStringthe application identifier for which to generate the progressive
tableNameStringtable name for which to generate the progressive
columnNameStringcolumn name associated with the progressive
separatedTransactionBooleanif true, the operation is executed in a separate transaction
interruptExecutionBooleanif true, on error the execution is interrupted with rollback

✅ Returns

the next progressive value

⚠️ Throws

  • Throwable in case of errors during progressive retrieval

getProgressive​

Obtains the next progressive value for the specified column in the given table. The progressive is generated via the WAGJsUtilsBean.getProgressive bean which atomically updates the counter in the platform's progressives table.

Syntax

//return Long type
var risp = utils.getProgressive(
tableName, //String
columnName, //String
separatedTransaction, //Boolean
interruptExecution //Boolean
);

Details

ArgumentTypeDescription
tableNameStringtable name for which to generate the progressive
columnNameStringcolumn name associated with the progressive
separatedTransactionBooleanif true, the operation is executed in a separate transaction (via remote call through ServerProxyFactory); if false, it is executed within the current transaction
interruptExecutionBooleanif true, on error the action execution is interrupted and a rollback is performed

✅ Returns

the next progressive value

⚠️ Throws

  • Throwable in case of errors during progressive retrieval

getQueryColumns​

Retrieve the column metadata (names and types) from the given SQL query without fetching any data rows. Useful for inspecting the structure of a result set before executing the actual query.

Syntax

//return String type
var risp = utils.getQueryColumns(
sql, //String
dataStoreId, //Long
separatedTransaction, //Boolean
interruptExecution, //Boolean
pars //Object[]
);

Details

ArgumentTypeDescription
sqlStringthe SQL SELECT query whose column metadata should be retrieved
dataStoreIdLongthe data source id identifying the target database schema; if null, the default data source is used
separatedTransactionBooleanif true, the query is executed in a new, independent transaction; if false, it participates in the current transaction
interruptExecutionBooleanif true, a SQL error will interrupt the entire server-side action execution; if false, the error is logged but execution continues
parsObject[]optional bind parameters for the SQL query, corresponding to ? placeholders in the SQL string, in positional order

✅ Returns

a JSON string describing the columns of the query result set (column names and types)

⚠️ Throws

  • Throwable if a database error occurs and interruptExecution is true

getRelation​

Get the list of fields from the FK table to the PK table; each element of the list contains an object: the fk field, the pk field and the fk name. The result is expressed as a JSON string containing: [{ "fkColumnName": "...", "pkColumnName": "...", "fkName": "..." },...]

Syntax

//return String type
var risp = utils.getRelation(
dataStoreId, //Long
fkTable, //String
pkTable //String
);

Details

ArgumentTypeDescription
dataStoreIdLongoptional datastore identifier from which the relation metadata must be read.
fkTableStringname of the foreign-key table that contains the referencing columns.
pkTableStringname of the primary-key table referenced by fkTable.

getResourceByLanguageId​

Retrieves a translated resource string for the given entry key and a specific language. Unlike getResource, this method allows fetching translations for a language different from the current user's language. Translations are cached per language to avoid repeated lookups. The method combines translations from both .properties files (custom resources) and database-stored translations (CON32 table) via the WAGTranslationsBean.

Syntax

//return String type
var risp = utils.getResourceByLanguageId(
entry, //String
languageId //String
);

Details

ArgumentTypeDescription
entryStringthe resource key to look up
languageIdStringthe ISO language identifier (e.g., "IT", "EN", "DE"); if null or empty, falls back to getResource

✅ Returns

the translated string for the specified language, or the entry key itself if no translation is found


getResource​

Retrieves a translated resource string for the given entry key, using the current user's language. The resource is looked up from standard i18n property bundles loaded for the application.

Syntax

//return String type
var risp = utils.getResource(
entry //String
);

Details

ArgumentTypeDescription
entryStringthe resource key to look up (e.g., "btn.save", "msg.error.required")

✅ Returns

the translated string for the current user's language, or the entry key itself if not found


getSchedNextActivationTime​

Return the nex activation time of scheduled process

Syntax

//return String type
var risp = utils.getSchedNextActivationTime(
schedId //Long
);

Details

ArgumentTypeDescription
schedIdLongof scheduled process

✅ Returns

string date with format "dd/MM/yyyy HH:mm:ss.SSS"

⚠️ Throws

  • Throwable

getSheetListFromExcelFile​

Retrieves the list of sheet names from an Excel file (xls or xlsx).

Syntax

//return String type
var risp = utils.getSheetListFromExcelFile(
dirId, //Long
fileName //String
);

Details

ArgumentTypeDescription
dirIdLongthe platform directory identifier where the Excel file is located
fileNameStringthe name of the Excel file to inspect

✅ Returns

a JSON-formatted string containing the list of sheet names in the workbook

⚠️ Throws

  • Throwable if the file cannot be read or a processing error occurs

getSubstitutedText​

Replaces variable placeholders in the given text with their corresponding values. Placeholders follow the pattern :variableName and are replaced first from the session-level variables (this.vars) and then from the user-supplied map. Example: given text "SELECT FROM T WHERE COL1 = :myParam" and myVariables containing \{"myParam": "ABC"}, returns "SELECT FROM T WHERE COL1 = ABC".

Syntax

//return String type
var risp = utils.getSubstitutedText(
text, //String
myVariables //Map
);

Details

ArgumentTypeDescription
textStringthe text containing :variableName placeholders to be replaced
myVariablesMapa Map<String, Object> of user-defined variables where: (details below)

myVariables​

a Map<String, Object> of user-defined variables where:

  • keys (String): variable names matching placeholders in the text (without the ":" prefix)
  • values (Object): replacement values; toString() is called on non-null values, null values are replaced with an empty string

✅ Returns

the text with all matching placeholders replaced by their corresponding values

⚠️ Throws

  • Exception if a regex replacement error occurs

getTablesInDataStore​

Syntax

//return String type
var risp = utils.getTablesInDataStore(
datastoreId //Long
);

Details

ArgumentTypeDescription
datastoreIdLong

getTxtFileCharset​

Detects and returns the character encoding of the specified text file. Uses the Mozilla Universal Charset Detector (juniversalchardet) to analyze the file content.

Syntax

//return String type
var risp = utils.getTxtFileCharset(
fileName //String
);

Details

ArgumentTypeDescription
fileNameStringthe absolute path to the text file to analyze

✅ Returns

the detected charset name (e.g. "WINDOWS-1252", "UTF-8", "ISO-8859-1")

⚠️ Throws

  • Exception if an I/O error occurs while reading the file
  • RuntimeException if no encoding can be detected from the file content

getUserRoles​

Retrieves the list of roles assigned to a user for the current application.

Syntax

//return ArrayList type
var risp = utils.getUserRoles(
companyId, //String
siteId, //Long
userCodeId //String
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
userCodeIdStringthe user code identifier (will be converted to uppercase)

✅ Returns

a list of UserRoleGrid objects representing the user's assigned roles

⚠️ Throws

  • Throwable if the user is not found or a server communication error occurs

getVariable​

Syntax

//return Object type
var risp = utils.getVariable(
varName //String
);

Details

ArgumentTypeDescription
varNameStringname of the session/action variable to read from vars.

✅ Returns

value of variable


getWebContentWithHeadersAndCookies [Deprecated]​

Executes an HTTP(s) connection with custom headers and cookies support, and fetches the result as a String. This is a convenience overload that builds a settings map and delegates to Map).

Syntax

//return String type
var risp = utils.getWebContentWithHeadersAndCookies(
uri, //String
replaceVariables, //boolean
httpMethod, //String
contentType, //String
requestBody, //Object
user, //String
pwd, //String
charSet, //String
headers, //Map
timeout, //Number
cookie, //boolean
dirId, //Long
sendFileName //String
);

Details

ArgumentTypeDescription
uriStringURI, expressed as http:// or https:// with or without variables expressed as :XXX
replaceVariablesbooleanflag used to replace variables within the URI
httpMethodString(optional: can be null); HTTP method: GET, POST, etc.
contentTypeString(optional: can be null); content type request (e.g. application/json)
requestBodyObject(optional: can be null); request body as a String
userString(optional: can be null); username for BASIC authentication
pwdString(optional: can be null); password for BASIC authentication
charSetString(optional: can be null); character set for the response encoding
headersMap(optional: can be null); custom HTTP headers as key-value pairs
timeoutNumber(optional: can be null); connection timeout in milliseconds
cookiebooleantrue to reuse the instance cookie list for this request; false to perform the call without sending/storing cookies.
dirIdLong(optional: can be null)
sendFileNameString(optional: can be null)

✅ Returns

the HTTP response as a String

⚠️ Throws

  • Exception in case of connection or I/O errors

getWebContentWithHeadersAndCookies​

Executes an HTTP(s) connection with custom headers and cookies support, and fetches the result as a String. This is a convenience overload that builds a settings map and delegates to Map).

Syntax

//return String type
var risp = utils.getWebContentWithHeadersAndCookies(
uri, //String
replaceVariables, //boolean
httpMethod, //String
contentType, //String
requestBody, //String
user, //String
pwd, //String
charSet, //String
headers, //Map
timeout //Number
);

Details

ArgumentTypeDescription
uriStringURI, expressed as http:// or https:// with or without variables expressed as :XXX
replaceVariablesbooleanflag used to replace variables within the URI
httpMethodString(optional: can be null); HTTP method: GET, POST, etc.
contentTypeString(optional: can be null); content type request (e.g. application/json)
requestBodyString(optional: can be null); request body as a String
userString(optional: can be null); username for BASIC authentication
pwdString(optional: can be null); password for BASIC authentication
charSetString(optional: can be null); character set for the response encoding
headersMap(optional: can be null); custom HTTP headers as key-value pairs
timeoutNumber(optional: can be null); connection timeout in milliseconds

✅ Returns

the HTTP response as a String

⚠️ Throws

  • Exception in case of connection or I/O errors

getWebContentWithHeaders [Deprecated]​

Execute an HTTP(s) connection and fetch the result, expresses as a String (e.g. a JSON or XML result content)

Syntax

//return String type
var risp = utils.getWebContentWithHeaders(
uri, //String
replaceVariables, //boolean
httpMethod, //String
contentType, //String
requestBody, //String
user, //String
pwd, //String
charSet, //String
headers //Map
);

Details

ArgumentTypeDescription
uriStringURI, expressed as http:// or https:// with or without variables, expressed as :XXX
replaceVariablesbooleanflag used to replace variables within the uri (variables are expressed as :XXX)
httpMethodString(optional: can be null); if specified, it defines the HTTP method: GET, POST
contentTypeString(optional: can be null); if specified, it defines the content type request (e.g. application/json)
requestBodyString(optional: can be null); if specified, it defines the request body, expressed as a String (e.g. a JSON or XML content)
userString(optional: can be null); if specified, it defines the username for a BASIC authentication
pwdString(optional: can be null); if specified, it defines the password for a BASIC authentication
charSetStringoptional character set to use for request/response handling, for example UTF-8.
headersMapoptional custom HTTP headers to send with the request; keys are header names and values are header values.

✅ Returns

the HTTP response, expressed as a String (e.g. a JSON or XML result)

⚠️ Throws

  • Exception

getWebContentWithSettings [Deprecated]​

Execute an HTTP(s) connection and fetch the result as a String (e.g. JSON or XML content). This variant accepts additional settings for fine-grained control over HTTP behavior.

Syntax

//return String type
var risp = utils.getWebContentWithSettings(
uri, //String
replaceVariables, //boolean
httpMethod, //String
contentType, //String
requestBody, //String
user, //String
pwd, //String
charSet, //String
headers, //Map
timeout, //Number
additionalSettings //Map
);

Details

ArgumentTypeDescription
uriStringURI, expressed as http:// or https:// with or without variables expressed as :XXX
replaceVariablesbooleanflag used to replace variables within the URI (variables are expressed as :XXX)
httpMethodString(optional: can be null); if specified, defines the HTTP method: GET, POST, PUT, DELETE
contentTypeString(optional: can be null); if specified, defines the content type (e.g. application/json)
requestBodyString(optional: can be null); if specified, defines the request body as a String
userString(optional: can be null); username for BASIC authentication
pwdString(optional: can be null); password for BASIC authentication
charSetString(optional: can be null); character encoding for request/response (e.g. "UTF-8")
headersMap(optional: can be null); custom HTTP request headers as key-value pairs
timeoutNumber(optional: can be null); connection and socket timeout in seconds
additionalSettingsMap(optional: can be null); extra configuration map with supported keys: (details below)

additionalSettings​

(optional: can be null); extra configuration map with supported keys:

  • "log" (Boolean) — if false, suppresses HTTP request/response logging (default: true)
  • "enableSNIExtension" (String "true"/"false") — controls HTTPS SNI extension behavior

✅ Returns

the HTTP response as a String (e.g. JSON or XML)

⚠️ Throws

  • Exception in case of connection or I/O errors

getWebContent [Deprecated]​

Executes an HTTP(s) connection and fetches the result as a String (e.g. JSON or XML content). This is a convenience overload that builds a settings map and delegates to Map).

Syntax

//return String type
var risp = utils.getWebContent(
uri, //String
replaceVariables, //boolean
httpMethod, //String
contentType, //String
requestBody, //String
user, //String
pwd //String
);

Details

ArgumentTypeDescription
uriStringURI, expressed as http:// or https:// with or without variables expressed as :XXX
replaceVariablesbooleanflag used to replace variables within the URI (variables are expressed as :XXX)
httpMethodString(optional: can be null); if specified, defines the HTTP method: GET, POST
contentTypeString(optional: can be null); if specified, defines the content type request (e.g. application/json)
requestBodyString(optional: can be null); if specified, defines the request body as a String (e.g. JSON or XML content)
userString(optional: can be null); if specified, defines the username for BASIC authentication
pwdString(optional: can be null); if specified, defines the password for BASIC authentication

✅ Returns

the HTTP response as a String (e.g. JSON or XML result)

⚠️ Throws

  • Exception in case of connection or I/O errors

getWebContent​

Executes an HTTP(s) connection and fetches the result as a String (e.g. JSON or XML content). This is a convenience overload that builds a settings map and delegates to Map).

Syntax

//return String type
var risp = utils.getWebContent(
uri, //String
settings //Map
);

Details

ArgumentTypeDescription
uriStringURI, expressed as http:// or https:// with or without variables expressed as :XXX
settingsMapa Map containing the following expected keys: (details below)

settings​

a Map containing the following expected keys:

  • replaceVariables (Boolean, optional, default true): if true, replaces :XXX variable placeholders in the URI with session variable values
  • httpMethod (String, optional, default "GET"): the HTTP method (GET, POST, PUT, DELETE, PATCH)
  • contentType (String, optional): the Content-Type header value (e.g. "application/json", "multipart/form-data")
  • requestBody (String or byte[], optional): the request body; can be a String (JSON/XML) or byte[] for binary content
  • user (String, optional): username for HTTP BASIC authentication
  • pwd (String, optional): password for HTTP BASIC authentication
  • charSet (String, optional, default "UTF-8"): character encoding for request and response
  • headers (Map<String, Object>, optional): additional HTTP request headers as key-value pairs
  • timeout (Number, optional): connection and socket timeout in seconds
  • cookie (Boolean, optional, default false): if true, attaches the instance-level cookie list to the request
  • dirId (Long/Number, optional): platform directory ID from which to read a file as the request body (used when requestBody is null)
  • sendFileName (String, optional): file name within the directory identified by dirId to use as binary request body
  • log (Boolean, optional, default true): if false, suppresses request/response logging
  • additionalSettings (Map, optional): extra settings forwarded to WAGUtils; may contain:
    • enableSNIExtension (String "true"/"false"): controls HTTPS SNI extension behavior
  • appAnalysis (Boolean, optional, default true): if true, enables application-level request analysis
  • responseWithHeaders (Boolean, optional, default false): if true, includes response headers in the returned content
  • multiPartRequestBody (String, optional): JSON string containing additional fields for a multipart/form-data request
  • multiPartFileAttributeName (String, optional): the attribute name for the file part in a multipart request

✅ Returns

the HTTP response as a String (e.g. JSON or XML result)

⚠️ Throws

  • Exception in case of connection or I/O errors

getWindowPanelsNavigateTree​

Retrieves the navigation tree structure for all panels in a window, expressed as a JSON string.

Syntax

//return String type
var risp = utils.getWindowPanelsNavigateTree(
windowId, //Long
treeTranslation, //String
excludedProperties //String[]
);

Details

ArgumentTypeDescription
windowIdLongthe window identifier
treeTranslationStringif "Y", includes translated labels in the tree
excludedPropertiesString[](optional) list of property names to exclude from the tree output

✅ Returns

a JSON string representing the window's panel navigation tree

⚠️ Throws

  • Throwable in case of server communication errors

getXlsContentWithEncoding​

Reads the content of an XLS file with a specified character encoding. Delegates to WAGXlsUtils#getXlsContentWithEncoding.

Syntax

//return Map[] type
var risp = utils.getXlsContentWithEncoding(
dirId, //String
fileName, //String
encoding, //String
sheetIndex, //int
fromRow, //int
attributeNames //String[]
);

Details

ArgumentTypeDescription
dirIdStringdirectory identifier where the XLS file is located
fileNameStringname of the XLS file
encodingStringcharacter encoding to use when reading the file (e.g. "UTF-8", "ISO-8859-1")
sheetIndexintsheet index inside the spreadsheet, starting from 0
fromRowintrow index from which to start reading (first row has index 0)
attributeNamesString[]list of attribute names assigned to each column, from left to right

✅ Returns

an array of Maps, where each Map represents a row with attribute name keys and cell values

⚠️ Throws

  • Throwable in case of I/O or parsing errors

getXlsContent​

Read up to 10000 rows x 1000 columns from the xls file stored in the specified path and get back the content of a specific folder.

Syntax

//return Map[] type
var risp = utils.getXlsContent(
dirId, //String
fileName, //String
sheetIndex, //int
fromRow, //int
attributeNames //String[]
);

Details

ArgumentTypeDescription
dirIdStringpath identifier
fileNameStringname of the xls file
sheetIndexintsheet index inside the spreadsheet, starting from 0
fromRowintthe content will be read starting from the specified row index (the first row has index 0)
attributeNamesString[]attribute names assigned to each spreadsheet column from left to right when building the returned row maps.

✅ Returns

a list of js objects, where each object is expressed as a set of couples @parsm attributeNames, list of attributes, assigned to each column, starting from leftmost column to the right


importCellsFromExcelFile​

Imports cell data from an Excel file using a predefined value import configuration. The import configuration determines how cells are mapped to database fields.

Syntax

//return boolean type
var risp = utils.importCellsFromExcelFile(
directoryId, //Long
fileName, //String
valueImportId, //Long
fieldsData, //Map
inputData, //Map
separatedTransaction //Boolean
);

Details

ArgumentTypeDescription
directoryIdLongdirectory identifier where the Excel file is located
fileNameStringname of the Excel file to import
valueImportIdLongthe value import configuration identifier (defines cell-to-field mappings)
fieldsDataMapa Map of additional field data to merge during import; keys are field names, values are the data to assign
inputDataMapa Map of input parameters for the import process; keys are parameter names, values are parameter values
separatedTransactionBooleanif true, the import is executed in a separate transaction

✅ Returns

true if the import completed successfully

⚠️ Throws

  • Throwable in case of errors

importRowsFromFile​

Import rows from xls, xlsx and csv file

Syntax

//return String type
var risp = utils.importRowsFromFile(
dirId, //Long
fileName, //String
importId, //Long
insert, //boolean
maxErrors, //Long
maxRowErrors, //Long
inputData, //Map
destErrorsFileDirId, //Long
destErrorsFileName, //String
rollbackIfErrors, //boolean
async, //boolean
sheetTitle //String
);

Details

ArgumentTypeDescription
dirIdLongdirectory identifier where the source import file is stored.
fileNameStringname of the xls/xlsx/csv file to import.
importIdLongidentifier of the import-to-grid configuration that defines field mappings and validation rules.
insertbooleantrue to perform insert-only processing; false to allow insert-or-update behavior.
maxErrorsLongmaximum number of row-level validation errors allowed before stopping; null means no limit.
maxRowErrorsLongmaximum number of rows containing errors allowed before stopping; null means no limit.
inputDataMapoptional fixed field values to inject during import; keys are destination field names and values are the fixed values to apply.
destErrorsFileDirIdLongoptional directory identifier where the generated error file must be saved.
destErrorsFileNameStringoptional file name to use for the generated error report.
rollbackIfErrorsbooleantrue to rollback the whole import when errors occur; false to commit successful rows and still return/report the errors.
asyncbooleantrue to execute the import asynchronously; false to run it synchronously.
sheetTitleStringoptional worksheet title to read when the source file is an Excel workbook.

⚠️ Throws

  • Throwable

importRowsFromFile​

Import rows from xls, xlsx and csv file

Syntax

//return String type
var risp = utils.importRowsFromFile(
dirId, //Long
fileName, //String
importId, //Long
insert, //boolean
maxErrors, //Long
maxRowErrors, //Long
inputData, //Map
destErrorsFileDirId, //Long
destErrorsFileName, //String
rollbackIfErrors, //boolean
async //boolean
);

Details

ArgumentTypeDescription
dirIdLongdirectory identifier where the source import file is stored.
fileNameStringname of the xls/xlsx/csv file to import.
importIdLongidentifier of the import-to-grid configuration that defines field mappings and validation rules.
insertbooleantrue to perform insert-only processing; false to allow insert-or-update behavior.
maxErrorsLongmaximum number of row-level validation errors allowed before stopping; null means no limit.
maxRowErrorsLongmaximum number of rows containing errors allowed before stopping; null means no limit.
inputDataMapoptional fixed field values to inject during import; keys are destination field names and values are the fixed values to apply.
destErrorsFileDirIdLongoptional directory identifier where the generated error file must be saved.
destErrorsFileNameStringoptional file name to use for the generated error report.
rollbackIfErrorsbooleantrue to rollback the whole import when errors occur; false to commit successful rows and still return/report the errors.
asyncbooleantrue to execute the import asynchronously; false to run it synchronously.

⚠️ Throws

  • Throwable

importSubFolderInWebContext​

Save in CON119 the content of the specified subfolder of the web context for the specified app id, then zip it, in order to use it later, when starting the Platform service on another node.

Syntax

utils.importSubFolderInWebContext(
appId, //String
subfolderName //String
);

Details

ArgumentTypeDescription
appIdStringapplication identifier whose web-context subfolder must be exported into CON119.
subfolderNameStringname of the web-context subfolder to zip and import.

info​

Logs a message at INFO level. Shorthand for log(msg, "INFO").

Syntax

utils.info(
msg //String
);

Details

ArgumentTypeDescription
msgStringthe log message text @see #log(String, String)

insertMappedObject​

Execute an INSERT SQL statement into the specified table, starting from the javascript NEUTRAL object passed as argument, containing many more attributes, not all related to such a table. The right attributes to take into account from the neutral object will be selected using the mapping defined to the specifie data model and table name. All object attributes will be converted to database fields (uncamel format); example: productCode -> PRODUCT_CODE

Syntax

//return boolean type
var risp = utils.insertMappedObject(
neutralObject, //Map
dataModelId, //Long
additionalAttributes, //Map
separatedTransaction, //Boolean
interruptExecution //Boolean
);

Details

ArgumentTypeDescription
neutralObjectMapjavascript object to insert into the specified table
dataModelIdLongdata model id, which MUST have MAPPER type, containing the mapping needed to extract the right attributes
additionalAttributesMapcan be null; if specified, contains additional to include the object under construction, used to generate the SQL instruction
separatedTransactionBooleanflag used to define if this query has to be performed in a separated transaction
interruptExecutionBooleanflag used to defined if the whole server side transaction must be interrupted and rollbacked in case of errors

✅ Returns

true if the record has been successfully inserted

⚠️ Throws

  • Throwable in case of errors

insertMappedObject​

Execute an INSERT SQL statement into the specified table, starting from the javascript NEUTRAL object passed as argument, containing many more attributes, not all related to such a table. The right attributes to take into account from the neutral object will be selected using the mapping defined to the specifie data model and table name. All object attributes will be converted to database fields (uncamel format); example: productCode -> PRODUCT_CODE

Syntax

//return boolean type
var risp = utils.insertMappedObject(
neutralObject, //Map
tableName, //String
dataModelId, //Long
additionalAttributes, //Map
separatedTransaction, //Boolean
interruptExecution //Boolean
);

Details

ArgumentTypeDescription
neutralObjectMapjavascript object to insert into the specified table
tableNameStringtable name which must be defined as a writable object
dataModelIdLongdata model id, which MUST have MAPPER type, containing the mapping needed to extract the right attributes
additionalAttributesMapcan be null; if specified, contains additional to include the object under construction, used to generate the SQL instruction
separatedTransactionBooleanflag used to define if this query has to be performed in a separated transaction
interruptExecutionBooleanflag used to defined if the whole server side transaction must be interrupted and rollbacked in case of errors

✅ Returns

true if the record has been successfully inserted

⚠️ Throws

  • Throwable in case of errors

insertObject​

Execute an INSERT SQL statement into the specified table, starting from the javascript object passed as argument. All object attributes will be converted to database fields (uncamel format); example: productCode -> PRODUCT_CODE

Syntax

//return boolean type
var risp = utils.insertObject(
obj, //Map
tableName, //String
dataSourceId, //Long
separatedTransaction, //Boolean
interruptExecution //Boolean
);

Details

ArgumentTypeDescription
objMapjavascript object to insert into the specified table
tableNameStringtable name which must be defined as a writable object (it MUST have a data model defined for that table)
dataSourceIdLongoptional data source id
separatedTransactionBooleanflag used to define if this query has to be performed in a separated transaction
interruptExecutionBooleanflag used to defined if the whole server side transaction must be interrupted and rollbacked in case of errors

✅ Returns

true if the record has been successfully inserted

⚠️ Throws

  • Throwable in case of errors

isExceededRowsOfCSVFile​

Checks whether a CSV file exceeds a specified row count limit. This is an alias for int) since CSV files are text files.

Syntax

//return boolean type
var risp = utils.isExceededRowsOfCSVFile(
filePath, //String
limit //int
);

Details

ArgumentTypeDescription
filePathStringthe absolute path to the CSV file
limitintthe maximum number of rows allowed

✅ Returns

true if the file has more rows than the specified limit, false otherwise

⚠️ Throws

  • Throwable if the file cannot be read or does not exist

isExceededRowsOfTextFile​

Checks whether a text file exceeds a specified row count limit without reading the entire file. Uses stream limiting to efficiently short-circuit as soon as the limit is exceeded.

Syntax

//return boolean type
var risp = utils.isExceededRowsOfTextFile(
filePath, //String
limit //int
);

Details

ArgumentTypeDescription
filePathStringthe absolute path to the text file
limitintthe maximum number of rows allowed

✅ Returns

true if the file has more rows than the specified limit, false otherwise

⚠️ Throws

  • Throwable if the file cannot be read or does not exist

isOffLine​

return true if a device ID is set (indicating offline/mobile mode), false otherwise

Syntax

//return boolean type
var risp = utils.isOffLine();

✅ Returns

true if a device ID is set (indicating offline/mobile mode), false otherwise


lPad​

Left-pads a string with the specified character to the given total length.

Syntax

//return String type
var risp = utils.lPad(
value, //String
fillChar, //char
length //int
);

Details

ArgumentTypeDescription
valueStringthe string to pad
fillCharcharthe character to use for padding
lengthintthe desired total length of the resulting string

✅ Returns

the left-padded string


lTrim​

Removes leading whitespace characters from the input string (left trim). Whitespace is defined by Character#isWhitespace.

Syntax

//return String type
var risp = utils.lTrim(
text //String
);

Details

ArgumentTypeDescription
textStringthe string to left-trim; may be null or empty

✅ Returns

the left-trimmed string, or the original value if null or empty


loadPDFFont​

Loads an external TrueType font from a file and registers it with the PDF document under the given alias. The font can then be referenced by alias in int, int, String, Map) via the "fontName" key in the settings Map.

Syntax

utils.loadPDFFont(
uuid, //String
fontAlias, //String
fontFileName //String
);

Details

ArgumentTypeDescription
uuidStringthe output stream identifier returned by Long, Map)
fontAliasStringa short alias name to reference the font in subsequent operations (e.g., "DejaVuSans")
fontFileNameStringthe absolute path to the TrueType font file (.ttf) on the server file system

⚠️ Throws

  • Throwable if the font file cannot be loaded
  • RuntimeException if the PDF file has not been opened (uuid not found)

logInCon60​

Logs a message into the platform's CON60 logging table.

Syntax

utils.logInCon60(
logType, //String
msg, //String
messageTag //String
);

Details

ArgumentTypeDescription
logTypeStringthe log type (e.g. "ERROR", "INFO", "DEBUG")
msgStringthe message to log
messageTagStringan optional tag to categorize the log entry

logServiceElaborationTag​

Fill in the specified tag (1..5) with the specified value.

Syntax

utils.logServiceElaborationTag(
tagNumber, //Long
tagValue //String
);

Details

ArgumentTypeDescription
tagNumberLong1..5 tag index
tagValueStringtag value

⚠️ Throws

  • Throwable

logServiceElaboration​

Append a message into the linked monitored service and send notification.

Syntax

utils.logServiceElaboration(
logType, //String
logMessage, //String
messageCode, //String
fileName, //String
sendNotification //Boolean
);

Details

ArgumentTypeDescription
logTypeStringFATAL, ERROR, INFO, DEBUG, FINEST
logMessageStringmessage to log
messageCodeString(optional) application code for log
fileNameString(optional) set if you processed a file
sendNotificationBooleantrue if you want send notify

logServiceElaboration​

Append a message into the linked monitored service and send notification.

Syntax

utils.logServiceElaboration(
logType, //String
logMessage, //String
messageCode, //String
fileName //String
);

Details

ArgumentTypeDescription
logTypeStringFATAL, ERROR, INFO, DEBUG, FINEST
logMessageStringmessage to log
messageCodeString(optional) application code for log
fileNameString(optional) set if you processed a file

logServiceFileElaboration​

Logs a file elaboration event for the linked monitored service. This is a convenience overload that delegates to the full version with note set to null.

Syntax

utils.logServiceFileElaboration(
operation, //String
elaborated, //Boolean
fileName, //String
directoryId, //Long
backupFilename, //String
backupDirectoryId, //Long
note //String
);

Details

ArgumentTypeDescription
operationStringthe operation type performed on the file (e.g. "READ", "WRITE", "IMPORT")
elaboratedBooleantrue if the file was successfully elaborated
fileNameStringthe name of the file that was processed
directoryIdLongdirectory identifier where the processed file is located
backupFilenameString(optional) backup file name if the file was backed up
backupDirectoryIdLong(optional) directory identifier for the backup location
noteString(optional) additional note or description for the log entry

⚠️ Throws

  • Throwable in case of server communication errors

logServiceFileElaboration​

Logs a file elaboration event for the linked monitored service. This is a convenience overload that delegates to the full version with note set to null.

Syntax

utils.logServiceFileElaboration(
operation, //String
elaborated, //Boolean
fileName, //String
directoryId, //Long
backupFilename, //String
backupDirectoryId //Long
);

Details

ArgumentTypeDescription
operationStringthe operation type performed on the file (e.g. "READ", "WRITE", "IMPORT")
elaboratedBooleantrue if the file was successfully elaborated
fileNameStringthe name of the file that was processed
directoryIdLongdirectory identifier where the processed file is located
backupFilenameString(optional) backup file name if the file was backed up
backupDirectoryIdLong(optional) directory identifier for the backup location

⚠️ Throws

  • Throwable in case of server communication errors

logServiceFileElaboration​

Logs a file elaboration event for the linked monitored service. This is a convenience overload that delegates to the full version with note set to null.

Syntax

utils.logServiceFileElaboration(
operation, //String
state, //String
fileName, //String
directoryId, //Long
backupFilename, //String
backupDirectoryId, //Long
note //String
);

Details

ArgumentTypeDescription
operationStringthe operation type performed on the file (e.g. "READ", "WRITE", "IMPORT")
stateStringthe elaboration state as a string (e.g. "OK", "ERROR", "SKIPPED")
fileNameStringthe name of the file that was processed
directoryIdLongdirectory identifier where the processed file is located
backupFilenameString(optional) backup file name if the file was backed up
backupDirectoryIdLong(optional) directory identifier for the backup location
noteString(optional) additional note or description for the log entry

⚠️ Throws

  • Throwable in case of server communication errors

log​

Logs a message at the specified log level. The message is enriched with thread and action identifiers. If the current action is associated with a monitored service, the log entry is also persisted to the service elaboration logs table (CON122) for auditing purposes.

Syntax

utils.log(
msg, //String
logType //String
);

Details

ArgumentTypeDescription
msgStringthe log message text
logTypeStringthe log level: "ERROR", "WARN", "INFO", or "DEBUG" (case-insensitive); if null or unrecognized, defaults to DEBUG level @implNote The message is prefixed with the current thread name/id and action id before logging. If a monitored service is configured for the current action (CON120), the log is additionally persisted via WAGServiceElaborationLogsBean.insertRecord() through ServerProxy.

mapClobFieldToTable​

Reads a source table containing raw CSV data stored in a CLOB field and loads a destination table by distributing (mapping) the CLOB content to individual columns. Supports: Copying fields as-is from the source table to the destination table Filling destination fields with default constant values Distributing (splitting) the CLOB field content by separator into mapped destination fields Additionally executes data validations on each mapped field: Mandatory check Field type validation (TEXT, INT, DEC, DATE) and format Field length validation Enumeration validation In case of invalid data, errors are saved back to the source table record (in the error fields). The destination table is always cleared first using the provided deleteFilter.

Syntax

//return String type
var risp = utils.mapClobFieldToTable(
settings //Map
);

Details

ArgumentTypeDescription
settingsMapa Map containing the following expected keys: (details below)

settings​

a Map containing the following expected keys:

  • srcTableName (String, required): name of the source table containing the CLOB data
  • srcFilter (String, optional): SQL WHERE clause to filter source rows
  • srcRowId (String, optional): row identifier field in the source table
  • srcDatasourceId (Number, optional): data source identifier for the source table connection
  • destTableName (String, required): name of the destination table to load
  • destFilter (String, optional): SQL WHERE filter for the destination table
  • destDatasourceId (Number, optional): data source identifier for the destination table connection
  • clobFieldName (String, required): name of the CLOB column in the source table
  • separator (String, required): field separator character used to split the CLOB content
  • uniqueKeys (String, optional): comma-separated list of fields representing a unique key
  • errorFieldName (String, optional): field name in source table to store validation error details
  • containsErrorsField (String, optional): field name in source table for error flag ("Y"/"N")
  • asIsFields (Map<String, String>, optional): map of source field names to destination field names that should be copied as-is from the source record
  • defaultFields (Map<String, Object>, optional): map of destination field names to constant default values to insert in every row
  • mappedFields (List, optional): ordered list of field mapping definitions, each Map containing:
    • fieldName (String): destination column name
    • fieldType (String): data type — "TEXT", "INT", "DEC", or "DATE"
    • mandatory (Boolean): whether a value is required
    • mapped (Boolean): if false, the positional CLOB field is skipped (not inserted)
    • decSeparator (String, default "."): decimal separator for DEC fields
    • dateFormat (String, default "yyyy-MM-dd"): date format pattern for DATE fields
    • fieldInt (Number): max integer digits for INT/DEC validation
    • fieldDec (Number): max decimal digits for DEC validation
    • fieldLength (Number): max character length for TEXT validation
    • enumeration (String): comma-separated list of allowed values
  • deleteFilter (String, optional): SQL WHERE clause used to clear destination table before loading
  • commitSize (Number, optional, default 1000): number of rows per batch commit

✅ Returns

a JSON string containing the processing result or error details

⚠️ Throws

  • Throwable if a database or I/O error occurs

markMessagesAsSeen​

Marks email messages as seen (read) on the mail server.

Syntax

//return Boolean type
var risp = utils.markMessagesAsSeen(
server, //String
port, //Integer
username, //String
password, //String
protocol, //String
useTLS, //Boolean
messageIds, //String[]
folderName, //String
setAsSeen, //Boolean
debug //Boolean
);

Details

ArgumentTypeDescription
serverStringmail server host
portIntegermail server port
usernameStringusername for authentication
passwordStringpassword for authentication
protocolStringmail protocol (e.g. "imap", "imaps")
useTLSBooleanif true, uses TLS encryption
messageIdsString[]array of message IDs to mark as seen
folderNameStringfolder name where the messages are located
setAsSeenBooleanif true, marks messages as seen; if false, marks as unseen
debugBooleanif true, enables debug logging

✅ Returns

true if the messages were marked successfully

⚠️ Throws

  • Throwable in case of mail server communication errors

md5​

Computes the MD5 hash of the given text.

Syntax

//return String type
var risp = utils.md5(
text //String
);

Details

ArgumentTypeDescription
textStringthe input string to hash

✅ Returns

the MD5 hash as an uppercase hexadecimal string

⚠️ Throws

  • Exception in case of hashing errors

mergePdfs​

Merges multiple PDF files into a single destination PDF file. If the destination file already exists, it is deleted before merging. The order of pages in the output follows the order of the input files array.

Syntax

utils.mergePdfs(
destinationFile, //String
files //String[]
);

Details

ArgumentTypeDescription
destinationFileStringthe absolute path of the merged output PDF file
filesString[]one or more absolute paths to PDF files to merge, in the desired order

⚠️ Throws

  • Exception if any source file cannot be read or the merge operation fails

mkdir​

Creates the specified directory in the local file system, including any necessary intermediate directories.

Syntax

utils.mkdir(
path //String
);

Details

ArgumentTypeDescription
pathStringabsolute path of the directory to create

⚠️ Throws

  • Throwable in case of errors during creation

moveMessages​

Moves email messages from one folder to another on the mail server.

Syntax

//return Boolean type
var risp = utils.moveMessages(
server, //String
port, //Integer
username, //String
password, //String
protocol, //String
useTLS, //Boolean
messageIds, //String[]
folderName, //String
moveToFolder, //String
setAsSeen, //Boolean
debug //Boolean
);

Details

ArgumentTypeDescription
serverStringmail server host
portIntegermail server port
usernameStringusername for authentication
passwordStringpassword for authentication
protocolStringmail protocol (e.g. "imap", "imaps")
useTLSBooleanif true, uses TLS encryption
messageIdsString[]array of message IDs to move
folderNameStringsource folder name
moveToFolderStringdestination folder name
setAsSeenBooleanif true, marks messages as seen after moving
debugBooleanif true, enables debug logging

✅ Returns

true if the messages were moved successfully

⚠️ Throws

  • Throwable in case of mail server communication errors

movePDFPage​

Moves the internal cursor to an existing page in the PDF document, allowing content to be appended to a previously created page. The current content stream is closed and a new one is opened in append mode for the target page.

Syntax

utils.movePDFPage(
uuid, //String
page //int
);

Details

ArgumentTypeDescription
uuidStringthe output stream identifier returned by Long, Map)
pageintzero-based page index to navigate to

⚠️ Throws

  • Throwable if the page does not exist or stream operations fail
  • RuntimeException if the PDF file has not been opened (uuid not found)

numberToText​

Converts a number to its textual representation (e.g., 123.45 to "one hundred twenty-three point forty-five"), respecting the specified language and decimal formatting options.

Syntax

//return String type
var risp = utils.numberToText(
num, //Number
decimals, //Number
languageId, //String
showDecimals, //Boolean
sep //String
);

Details

ArgumentTypeDescription
numNumberthe number to convert to text
decimalsNumberthe number of decimal places to round to before conversion
languageIdStringthe language identifier for the text representation (e.g., "IT", "EN")
showDecimalsBooleanif true, includes the decimal part in the text output; if false, only the integer part is converted
sepStringthe separator text between the integer and decimal parts (e.g., "/", "and")

✅ Returns

the textual representation of the number in the specified language

⚠️ Throws

  • Throwable if the server-side conversion fails

openCSVFile​

Open a CSV file, in order to write rows into it, using the "writeToCSVFile" method. Finally, the CSV file must be closed, using "closeCSVFile" method.

Syntax

//return String type
var risp = utils.openCSVFile(
fileName, //String
overwrite, //Boolean
directoryId, //Long
sep, //String
fileAppend, //Boolean
attributesToWrite, //String[]
formatters //String[]
);

Details

ArgumentTypeDescription
fileNameStringCSV filename
overwriteBooleanflag true|false, used to define whether the file must be overridden or not, in case it already exists.
directoryIdLongdir id, related to a path in the server file system
sepStringCSV field separator; allowed values are: , or ;
fileAppendBooleanflag true|false, used to define whether content must be added at the end of the already existing CSV file
attributesToWriteString[]list of attributes to write in the row, coming from the json row
formattersString[]list of formatters to use for each attributes, in order to convert a number to a text (e.g. "0" or "0.00", etc.) return file identifier, to pass forward to "writeToCSVFile" and "closeCSVFile" methods, in order to work with the already opened output stream

openPDFFile​

Opens a new PDF file for writing content. This is the entry point for the PDF generation lifecycle: openPDFFile → addPageToPDFFile/addLineToPDFFile/setLineToPDFFile/addImageToPDFFile/addBarcodeToPDFFile → closePDFFile. The method creates the file on disk, initializes an Apache PDFBox PDDocument, and returns a UUID that must be passed to all subsequent PDF operations. The document uses incremental saving to limit memory usage. If the file already exists, it is overwritten by default (controlled via the "overwriteFile" setting).

Syntax

//return String type
var risp = utils.openPDFFile(
fileName, //String
directoryId, //Long
settings //Map
);

Details

ArgumentTypeDescription
fileNameStringthe PDF file name (may include subdirectories relative to the directory path). Leading "/" is stripped; must not contain "../" patterns (path traversal protection)
directoryIdLongthe platform directory ID, resolved to a server file system path via getDirectoryPath()
settingsMapoptional configuration map. Supported keys: (details below)

settings​

optional configuration map. Supported keys:

  • "size" (String) — page size. Allowed values: "A0", "A1", "A2", "A3", "A4" (default), "A5", "A6", "LETTER"
  • "orientation" (String) — page orientation. Allowed values: "portrait" (default), "landscape"
  • "fontName" (String) — default font for pages. Allowed values: "Courier" (default), "Courier-Bold", "Courier-BoldOblique", "Courier-Oblique", "Helvetica", "Helvetica-Bold", "Helvetica-BoldOblique", "Helvetica-Oblique", "Symbol", "Times-Bold", "Times-BoldItalic", "Times-Italic", "Times-Roman", "ZapfDingbats"
  • "fontSize" (Number) — default font size in points (default: 10)
  • "top" (Number) — top margin in points (default: 20)
  • "left" (Number) — left margin in points (default: 20)
  • "bottom" (Number) — bottom margin in points (default: 20)
  • "height" (Number) — line height in points (default: 10)
  • "overwriteFile" (Boolean) — if false, loads and appends to an existing file instead of overwriting it (default: true)

✅ Returns

a UUID string identifying the opened PDF output stream; pass this to all subsequent PDF methods

⚠️ Throws

  • Throwable if the directory cannot be resolved or the file cannot be created/loaded
  • RuntimeException if the file path contains "../" (path traversal attempt)

openTextFile​

Open a text file, in order to write rows into it, using the "writeToTextFile" method. Finally, the text file must be closed, using "closeTextFile" method.

Syntax

//return String type
var risp = utils.openTextFile(
fileName, //String
overwrite, //Boolean
directoryId, //Long
fileAppend, //Boolean
charset //String
);

Details

ArgumentTypeDescription
fileNameStringtext filename
overwriteBooleanflag true|false, used to define whether the file must be overridden or not, in case it already exists.
directoryIdLongdir id, related to a path in the server file system
fileAppendBooleanflag true|false, used to define whether content must be added at the end of the already existing text file return file identifier, to pass forward to "writeToTextFile" and "closeTextFile" methods, in order to work with the already opened output stream
charsetStringoptional character set used when creating/appending the text file; if null, UTF-8 is used.

openTextFile​

Open a text file, in order to write rows into it, using the "writeToTextFile" method. Finally, the text file must be closed, using "closeTextFile" method.

Syntax

//return String type
var risp = utils.openTextFile(
fileName, //String
overwrite, //Boolean
directoryId, //Long
fileAppend //Boolean
);

Details

ArgumentTypeDescription
fileNameStringtext filename
overwriteBooleanflag true|false, used to define whether the file must be overridden or not, in case it already exists.
directoryIdLongdir id, related to a path in the server file system
fileAppendBooleanflag true|false, used to define whether content must be added at the end of the already existing text file return file identifier, to pass forward to "writeToTextFile" and "closeTextFile" methods, in order to work with the already opened output stream

parseJSON​

Parses a JSON string into a Java object. If the string starts with "{", it is parsed into a Map. If it starts with "[", it is parsed into a List.

Syntax

//return Object type
var risp = utils.parseJSON(
json //String
);

Details

ArgumentTypeDescription
jsonStringthe JSON string to parse

✅ Returns

a Map (for JSON objects) or a List (for JSON arrays)

⚠️ Throws

  • RuntimeException if the string is not valid JSON (doesn't start with "{" or "[")

parseXML​

Parse a simple XML document and generate a Javascript "compatible" representation, expressed using lists and js objects, where each js object has special attributes named: "tagName", "tagValue" and "subTags". The document (list of tags) is expressed as a list of js objects, where each js object can have a list of subtags and attributes, expressed object's attributes. The js object always contains special entries named "tagName", "subTags" and optionally "tagValue" if there is tag value.

Syntax

//return Map[] type
var risp = utils.parseXML(
xmlDocument //String
);

Details

ArgumentTypeDescription
xmlDocumentString

✅ Returns

XML representation, expressed as a list of Javascript objects


printDocument​

Generate a report starting from a .jasper report template and print it directly to the specified printer.

Syntax

//return String type
var risp = utils.printDocument(
printerName, //String
copies, //int
mediaSize, //Integer
printParams, //Object>
reportName, //String
dirReports, //String
datastoreId, //Long
reportFormat, //String
reportParams //Object>
);

Details

ArgumentTypeDescription
printerNameStringprinter identifier; it can be retrieved by calling "getPrintServices" js method
copiesintnumber of copies to print
mediaSizeIntegerpaper size, expressed as a number between 0 and 10 (i.e. A0...A10); can be null
printParamsObject>parameters to pass to the printer
reportNameString.jasper report name
dirReportsStringoptional folder where the .jasper file is located; this relative path is always contained within the subolder /reports/
datastoreIdLongoptional data source id used by the .jasper template to read data from the database
reportFormatStringreport format to use when creating the report; e.g. PDF
reportParamsObject>input parameters required by the report template

✅ Returns

error message, in case of errors; "Report printed." if the generation has been successfully completed


protectPdf​

Applies password-based protection and access restrictions to a PDF document. The protected PDF cannot be printed or modified by users who open it with the restriction password. The owner password grants full access for removing restrictions. If fullPathDst is null, the source file is overwritten with the protected version.

Syntax

utils.protectPdf(
passwordRestriction, //String
passwordOwner, //String
fullPathSrc, //String
fullPathDst //String
);

Details

ArgumentTypeDescription
passwordRestrictionStringthe user password required to open the document (restricts access)
passwordOwnerStringthe owner password granting full control (can remove restrictions)
fullPathSrcStringabsolute path to the source PDF file to protect
fullPathDstStringabsolute path for the protected output file; if null, the source file is overwritten

⚠️ Throws

  • Exception if the PDF cannot be loaded, encrypted, or saved

rPad​

Right-pads a string with the specified character to the given total length.

Syntax

//return String type
var risp = utils.rPad(
value, //String
fillChar, //char
length //int
);

Details

ArgumentTypeDescription
valueStringthe string to pad
fillCharcharthe character to use for padding
lengthintthe desired total length of the resulting string

✅ Returns

the right-padded string


rTrim​

Removes trailing whitespace characters from the input string (right trim). Whitespace is defined by Character#isWhitespace.

Syntax

//return String type
var risp = utils.rTrim(
text //String
);

Details

ArgumentTypeDescription
textStringthe string to right-trim; may be null or empty

✅ Returns

the right-trimmed string, or the original value if null or empty


readBase64File​

Read a local file and convert it to BASE 64 text format.

Syntax

//return String type
var risp = utils.readBase64File(
filePath //String
);

Details

ArgumentTypeDescription
filePathStringpath + file name to read

✅ Returns

BASE64 representation of the specified file


readCSVFileAndWriteToTable​

Read a CSV file stored in the server file system and insert each row as a record in a database table.

Syntax

//return long type
var risp = utils.readCSVFileAndWriteToTable(
fileName, //String
directoryId, //Long
sep, //String
skipFirstRow, //Boolean
datastoreId, //Long
tableName, //String
defaultFieldNames, //Map
csvFields, //Map[]
limitRows, //Integer
throwIfExceededRows //Boolean
);

Details

ArgumentTypeDescription
fileNameStringCSV file name, stored in the specified directory
directoryIdLongdirectory identifier, related to a folder in the server file system
sepStringCSV separator; allowed values are: , and ;
skipFirstRowBooleanflag true|false used to define whether the first row in the CSV file must be ignored (e.g. in case of a first row containing the column headers)
datastoreIdLongoptional datastore identifier where the generated INSERT statements must be executed.
tableNameStringtable name where saving records
defaultFieldNamesMapmap containing fieldname+default value, to include in the record INSERT, if not included in the CSV file
csvFieldsMap[]list of fields contained in the CSV file and for each, properties about its usage; properties are defined according to this structure: { fieldName: "...", trim: true|false, convertToSqlDate: "yyyy-MM-dd", convertToSqlTimestamp: "yyyy-MM-ddHH:mm:ss" }
limitRowsIntegermaximum number of row to read (default -1 no limit)
throwIfExceededRowsBooleanflag true|false indicating whether the action execution must be interrupted in case of exceeded rows { fieldName: "...", trim: true|false, convertToSqlDate: "yyyy-MM-dd", convertToSqlTimestamp: "yyyy-MM-ddHH:mm:ss" }

✅ Returns

number of processed records An INSERT is composed by including fieldNames+defaultFieldNames.


readCSVFileAndWriteToTable​

Read a CSV file stored in the server file system and insert each row as a record in a database table.

Syntax

//return long type
var risp = utils.readCSVFileAndWriteToTable(
fileName, //String
directoryId, //Long
sep, //String
skipFirstRow, //Boolean
datastoreId, //Long
tableName, //String
defaultFieldNames, //Map
csvFields //Map[]
);

Details

ArgumentTypeDescription
fileNameStringCSV file name, stored in the specified directory
directoryIdLongdirectory identifier, related to a folder in the server file system
sepStringCSV separator; allowed values are: , and ;
skipFirstRowBooleanflag true|false used to define whether the first row in the CSV file must be ignored (e.g. in case of a first row containing the column headers)
datastoreIdLongoptional datastore identifier where the generated INSERT statements must be executed.
tableNameStringtable name where saving records
defaultFieldNamesMapmap containing fieldname+default value, to include in the record INSERT, if not included in the CSV file
csvFieldsMap[]list of fields contained in the CSV file and for each, properties about its usage; properties are defined according to this structure: { fieldName: "...", trim: true|false, convertToSqlDate: "yyyy-MM-dd", convertToSqlTimestamp: "yyyy-MM-ddHH:mm:ss" }

✅ Returns

number of processed records An INSERT is composed by including fieldNames+defaultFieldNames.


readCSVFile​

Read a CSV file stored in the server file system and invoke the callback function" for each row. When invoking the callback function, a js object will be passed to it as an argument, containing the current row read from the CSV file.

Syntax

function callbackFunName(data) \{

\}

utils.readCSVFile(
fileName, //String
directoryId, //Long
sep, //String
skipFirstRow, //Boolean
callbackFunName, //String
attributeNames, //String[]
charSet, //String
limitRows, //int
throwIfExceededRows //boolean
);

Details

ArgumentTypeDescription
fileNameStringCSV file name, stored in the specified directory
directoryIdLongdirectory identifier, related to a folder in the server file system
sepStringCSV separator; allowed values are: , and ;
skipFirstRowBooleanflag true|false used to define whether the first row in the CSV file must be ignored (e.g. in case of a first row containing the column headers)
callbackFunNameStringcallback function name to invoke for each row; such a function must have a single argument, which will have the js object related to a row in the CSV file
attributeNamesString[]list of attribute names, to use for each column in the CSV file
charSetStringcharacter set used to decode the CSV file content; if null, UTF-8 is used.
limitRowsintmaximum number of row to read (default -1 no limit)
throwIfExceededRowsbooleanflag true|false indicating whether the action execution must be interrupted in case of exceeded rows

readCSVFile​

Read a CSV file stored in the server file system and invoke the callback function" for each row. When invoking the callback function, a js object will be passed to it as an argument, containing the current row read from the CSV file.

Syntax

function callbackFunName(data) \{

\}

utils.readCSVFile(
fileName, //String
directoryId, //Long
sep, //String
skipFirstRow, //Boolean
callbackFunName, //String
attributeNames, //String[]
charSet //String
);

Details

ArgumentTypeDescription
fileNameStringCSV file name, stored in the specified directory
directoryIdLongdirectory identifier, related to a folder in the server file system
sepStringCSV separator; allowed values are: , and ;
skipFirstRowBooleanflag true|false used to define whether the first row in the CSV file must be ignored (e.g. in case of a first row containing the column headers)
callbackFunNameStringcallback function name to invoke for each row; such a function must have a single argument, which will have the js object related to a row in the CSV file
attributeNamesString[]list of attribute names, to use for each column in the CSV file
charSetStringcharacter set used to decode the CSV file content; if null, UTF-8 is used.

readCSVFile​

Read a CSV file stored in the server file system and invoke the callback function" for each row. When invoking the callback function, a js object will be passed to it as an argument, containing the current row read from the CSV file.

Syntax

function callbackFunName(data) \{

\}

utils.readCSVFile(
fileName, //String
directoryId, //Long
sep, //String
skipFirstRow, //Boolean
callbackFunName, //String
attributeNames //String[]
);

Details

ArgumentTypeDescription
fileNameStringCSV file name, stored in the specified directory
directoryIdLongdirectory identifier, related to a folder in the server file system
sepStringCSV separator; allowed values are: , and ;
skipFirstRowBooleanflag true|false used to define whether the first row in the CSV file must be ignored (e.g. in case of a first row containing the column headers)
callbackFunNameStringcallback function name to invoke for each row; such a function must have a single argument, which will have the js object related to a row in the CSV file
attributeNamesString[]list of attribute names, to use for each column in the CSV file

readCsvAndLoadTable​

Reads a CSV file from a platform directory and bulk-loads its rows into a database table. Each row of the CSV is stored as-is in a CLOB field. Optionally, a numeric row ID or a UUID can be generated for each row, and additional constant fields can be inserted. The target table is always cleared first using the provided deleteFilter before loading new data. Data is committed in batches controlled by commitSize.

Syntax

utils.readCsvAndLoadTable(
settings //Map
);

Details

ArgumentTypeDescription
settingsMapa Map containing the following expected keys: (details below)

settings​

a Map containing the following expected keys:

  • srcDirId (Number, required): platform directory ID where the CSV source file is located
  • srcFileName (String, required): name of the CSV file to read
  • charSet (String, optional, default "UTF-8"): character encoding of the source file
  • idAsNum (String, optional): column name for an auto-incremented numeric row ID; if set, a sequential Long is assigned to each row
  • idAsUuid (String, optional): column name for a UUID row identifier; if set, a random UUID is assigned to each row
  • additionalFields (Map<String, Object>, optional): map of extra column names to constant values to insert in every row
  • headers (Boolean, optional): if true, the first row of the CSV file is skipped (treated as a header row)
  • datasourceId (Number, optional): data source identifier for the target database connection; if null, the default connection is used
  • tableName (String, required): name of the target database table
  • clobFieldName (String, required): name of the CLOB column where the raw CSV row will be stored
  • deleteFilter (String, optional): SQL WHERE clause used to clear existing rows before loading (e.g. "COMPANY_ID = 'ABC'")
  • commitSize (Number, optional, default 1000): number of rows per batch commit
  • separator (String, optional): field separator character (used only for multi-line row detection)
  • expectedFields (Number, optional): expected number of fields per row; if a row has fewer fields than this, the next line is appended (multi-line row handling)
  • newline (Boolean, optional, default true): when concatenating multi-line rows, if true inserts a newline character between parts; if false concatenates directly

⚠️ Throws

  • Throwable if a database error, file access error, or I/O error occurs

readTextFile​

Read a local file having text format.

Syntax

function callbackFunName(data) \{

\}

utils.readTextFile(
fileName, //String
directoryId, //Long
callbackFunName, //String
charSet, //String
limitRows, //int
throwIfExceededRows //boolean
);

Details

ArgumentTypeDescription
fileNameStringtext file name, stored in the specified directory
directoryIdLongdirectory identifier, related to a folder in the server file system
callbackFunNameStringcallback function name to invoke for each row; such a function must have a single argument, which will have the content of the current line (a text string)
charSetStringcharset to use when reading a text file
limitRowsintmaximum number of row to read (default -1 no limit)
throwIfExceededRowsbooleanflag true|false indicating whether the action execution must be interrupted in case of exceeded rows

readTextFile​

Read a local file having text format.

Syntax

function callbackFunName(data) \{

\}

utils.readTextFile(
fileName, //String
directoryId, //Long
callbackFunName, //String
charSet //String
);

Details

ArgumentTypeDescription
fileNameStringtext file name, stored in the specified directory
directoryIdLongdirectory identifier, related to a folder in the server file system
callbackFunNameStringcallback function name to invoke for each row; such a function must have a single argument, which will have the content of the current line (a text string)
charSetStringcharset to use when reading a text file

readTextFile​

Read a local file having text format.

Syntax

function callbackFunName(data) \{

\}

utils.readTextFile(
fileName, //String
directoryId, //Long
callbackFunName //String
);

Details

ArgumentTypeDescription
fileNameStringtext file name, stored in the specified directory
directoryIdLongdirectory identifier, related to a folder in the server file system
callbackFunNameStringcallback function name to invoke for each row; such a function must have a single argument, which will have the content of the current line (a text string)

readTextFile​

Read a local file having text format.

Syntax

function callbackFunName(data) \{

\}

utils.readTextFile(
fullPathName, //String
callbackFunName, //String
charSet, //String
limitRows, //int
throwIfExceededRows //boolean
);

Details

ArgumentTypeDescription
fullPathNameStringpath+filenae in the server file system
callbackFunNameStringcallback function name to invoke for each row; such a function must have a single argument, which will have the content of the current line (a text string)
charSetStringcharset to use when reading a text file
limitRowsintmaximum number of row to read (default -1 no limit)
throwIfExceededRowsbooleanflag true|false indicating whether the action execution must be interrupted in case of exceeded rows

readTextFile​

Read a local file having text format.

Syntax

function callbackFunName(data) \{

\}

utils.readTextFile(
fullPathName, //String
callbackFunName, //String
charSet //String
);

Details

ArgumentTypeDescription
fullPathNameStringpath+filenae in the server file system
callbackFunNameStringcallback function name to invoke for each row; such a function must have a single argument, which will have the content of the current line (a text string)
charSetStringcharset to use when reading a text file

readTextFile​

Read a local file having text format.

Syntax

//return String type
var risp = utils.readTextFile(
filePath, //String
charSet //String
);

Details

ArgumentTypeDescription
filePathStringpath + file name to read
charSetStringcharset to use when reading a text file

readTextFile​

Read a local file having text format.

Syntax

//return String type
var risp = utils.readTextFile(
filePath //String
);

Details

ArgumentTypeDescription
filePathStringpath + file name to read

removeAttribute​

Remove an attribute (e.g. "memberOf") from the entry identified by "filterDN".

Syntax

//return int type
var risp = utils.removeAttribute(
host, //String
port, //Integer
filterDN, //String
ldapUsername, //String
ldapPassword, //String
attributeNameToRemove, //String
attributeValueToRemove //String
);

Details

ArgumentTypeDescription
hostStringLDAP host
portIntegerLDAP port (optional: if not specified, 389 will be used)
filterDNStringbase DN to apply as a filter
ldapUsernameStringusername to use to authenticate to the LDAP server
ldapPasswordStringpassword to use to authenticate to the LDAP server
attributeNameToRemoveStringattribute name to remove from every entry matching the search criteria
attributeValueToRemoveStringattribute value to remove from every entry matching the search criteria

✅ Returns

number of entries found and updated


removeCustomApplUserVars​

Remove a custom parameter from the user session.

Syntax

utils.removeCustomApplUserVars(
code //String
);

Details

ArgumentTypeDescription
codeStringcustom session-variable key to remove from the user session.

removeLinkedDevices​

Remove current subdevice from Signal server.

Syntax

utils.removeLinkedDevices();

removeMembersFromChatGroup​

Removes members from an existing chat group. Retrieves the current group from the server, removes the specified members, and saves the updated group via the ChatManager singleton.

Syntax

utils.removeMembersFromChatGroup(
groupId, //String
myPhoneNumber, //String
contactPhoneNumbers //String>
);

Details

ArgumentTypeDescription
groupIdStringthe unique identifier of the chat group
myPhoneNumberStringthe phone number of the current user (kept in the group if not null)
contactPhoneNumbersString>list of phone numbers of the contacts to remove

⚠️ Throws

  • Throwable in case of server communication errors

removeSlashesForDatabaseField​

Convert a javascript object as a JSON string, containing escape characters for each " symbol, soi that it can be saved in a database field and re-read later in a compatible format for JSON.parse(); Example: stringifyForDatabaseField({ "text": "AB\\C" }) -> "{ "text": "AB\C" }"

Syntax

//return String type
var risp = utils.removeSlashesForDatabaseField(
json //String
);

Details

ArgumentTypeDescription
jsonStringJSON string previously escaped for database storage, whose escape slashes must be normalized when reading it back.

removeSlashesForJSON​

Convert a javascript object as a JSON string, containing escape characters for each " symbol, soi that it can be saved in a database field and re-read later in a compatible format for JSON.parse(); Example: removeSlashesForJSON({ "text": "AB\\C" }) -> "{ "text": "AB\C" }"

Syntax

//return String type
var risp = utils.removeSlashesForJSON(
json //String
);

Details

ArgumentTypeDescription
jsonStringJSON string previously escaped for storage, whose escape slashes must be normalized for JSON.parse compatibility.

removeTime​

Removes the time component (hours, minutes, seconds, milliseconds) from a date, returning a date with time set to 00:00:00.000.

Syntax

//return Date type
var risp = utils.removeTime(
date //Date
);

Details

ArgumentTypeDescription
dateDatethe date from which to remove the time component

✅ Returns

a new Date instance with the same date but time zeroed out


renameFTPFile [Deprecated]​

Rename or move file of the FTP server

Syntax

//return boolean type
var risp = utils.renameFTPFile(
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
fromFileName, //String
toFileName //String
);

Details

ArgumentTypeDescription
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
fromFileNameStringabsolute path of old file
toFileNameStringabsolute path of new file

⚠️ Throws

  • Exception

renameFTPFile​

Rename or move file of the FTP server

Syntax

//return boolean type
var risp = utils.renameFTPFile(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
fromFileName, //String
toFileName //String
);

Details

ArgumentTypeDescription
protocolStringFTP protocol type to use for the connection, for example FTP, FTPS, or SFTP.
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
fromFileNameStringabsolute path of old file
toFileNameStringabsolute path of new file

⚠️ Throws

  • Exception

renameFile​

Rename the specified file, stored in the local file system.

Syntax

//return boolean type
var risp = utils.renameFile(
directoryId, //Long
oldFileName, //String
newFileName //String
);

Details

ArgumentTypeDescription
directoryIdLongpath on the local file system, where the original file is located
oldFileNameStringold file name
newFileNameStringnew file name Fire an exception if the original file does not exist or the destination file already exists

✅ Returns

true if the renamoing operation was successful, false otherwise


replaceAll​

Replace all occurrences of the specified pattern within "text" with the new value.

Syntax

//return String type
var risp = utils.replaceAll(
text, //String
pattern, //String
changedValue //String
);

Details

ArgumentTypeDescription
textStringtext to analyze
patternStringpattern to search for
changedValueStringvalue that replaces all occurrences of the pattern

✅ Returns

new text where all occurrences of "pattern" have been replaced with "changedValue"


resume​

Resumes the execution of a previously suspended server-side JavaScript action. Sets the internal flag to allow the suspended thread to exit its wait loop. @see #suspend() @see #suspend(String)

Syntax

utils.resume();

round​

Rounds a number to the specified number of decimal places using HALF_UP rounding mode.

Syntax

//return Number type
var risp = utils.round(
num, //Number
decimals //int
);

Details

ArgumentTypeDescription
numNumberthe number to round; may be null
decimalsintthe number of decimal places to retain

✅ Returns

the rounded number as a BigDecimal, or null if the input is null

⚠️ Throws

  • Throwable never thrown under normal operation

saveBlob​

Load a binary file into a database field identified by "blobField" attribute in the table identified by "tableName" for an already existing record having the primary key identified by Array "pkNames" and values "pkValues". The file to load into the BLOB field is retrieved starting from the specified dirId + filename

Syntax

//return Integer type
var risp = utils.saveBlob(
settings //Map
);

Details

ArgumentTypeDescription
settingsMapjavascript object having the following structure { tableName: "...", blobField: "...", pkNames: ["..",...], pkValues: ["..",...], datastoreId: xyz, dirId: xyz, blobFileName: "..." }

✅ Returns

number of processed (updated) rows


saveDocument​

Generate a report starting from a .jasper report template and save it to the server file system, in the specified path.

Syntax

//return String type
var risp = utils.saveDocument(
reportName, //String
dirReports, //String
datastoreId, //Long
compId, //Long
reportFormat, //String
reportParams, //Object>
savePath //String
);

Details

ArgumentTypeDescription
reportNameString.jasper report name
dirReportsStringoptional folder where the .jasper file is located; this relative path is always contained within the subolder /reports/
datastoreIdLongoptional data source id used by the .jasper template to read data from the database
compIdLongoptional value: business component id to use to fill in the report
reportFormatStringreport format to use when creating the report; e.g. PDF
reportParamsObject>input parameters required by the report template
savePathStringpath where the generated report will be saved; it must includes the file name

✅ Returns

error message, in case of errors; "" if the generation has been successfully completed


saveEml​

Save the specified messages in EML format in the local file system, within the path specified through directoryId. In case of message id not valid, the corresponding saving is skipped and the method would get back all invalid message ids.

Syntax

//return String[] type
var risp = utils.saveEml(
server, //String
port, //Integer
username, //String
password, //String
protocol, //String
useTLS, //Boolean
folderName, //String
messageIds, //String[]
fileNames, //String[]
directoryId //Long
);

Details

ArgumentTypeDescription
serverStringserver host
portIntegerserver port
usernameStringusername to use when accessing the email server
passwordStringpassword to use when accessing the email server
protocolStringprotocol to use when connecting to the email server
useTLSBooleanflag used to enabled the TLS mode
folderNameStringname of the folder where the messages to delete are located
messageIdsString[]list of message ids related to messages to save in EML format
fileNamesString[]file names used to save the messages in EML format with such a name, one for each message id, in the same order
directoryIdLongdir id used to figure out where saving files

✅ Returns

list of message ids not valid


saveGridExportInCSV​

Export data defined starting from a grid and save it to the file system, in CSV format. Data is filtered according to the account specified.

Syntax

//return Boolean type
var risp = utils.saveGridExportInCSV(
appId, //String
companyId, //String
siteId, //Long
username, //String
password, //String
platformBaseUrl, //String
functionId, //String
panelId, //Long
filters, //List
orders, //List
attributes, //List
titles, //List
title, //String
toFile //String
);

Details

ArgumentTypeDescription
appIdStringapplication id
companyIdStringcompany id
siteIdLongsite id
usernameStringusername
passwordStringpassword
platformBaseUrlStringlocal URL to the 4WS.Platform web application (e.g. http://localhost:8080/platform)
functionIdStringfunction id, related to the grid linked to the export
panelIdLonggrid identifier
filtersListlist of tuples [attr,op,value], related to filters to apply to the base enquiry
ordersListlist of tuples [attr,ASC/DESC], related to sorting conditions to apply to the base enquiry
attributesListlist of attributes, representing the whole columns
titlesListcolumn headers
titleStringexport file
toFileStringabsolute path, including the file name (.csv), where saving the exported data

saveGridExportInExtendedCSV​

Export data defined starting from a grid and save it to the file system, in CSV format where columns linked to combos are decoded by exctrating descriptions instead of the real code. Data is filtered according to the account specified.

Syntax

//return Boolean type
var risp = utils.saveGridExportInExtendedCSV(
appId, //String
companyId, //String
siteId, //Long
username, //String
password, //String
platformBaseUrl, //String
functionId, //String
panelId, //Long
filters, //List
orders, //List
attributes, //List
titles, //List
title, //String
toFile //String
);

Details

ArgumentTypeDescription
appIdStringapplication id
companyIdStringcompany id
siteIdLongsite id
usernameStringusername
passwordStringpassword
platformBaseUrlStringlocal URL to the 4WS.Platform web application (e.g. http://localhost:8080/platform)
functionIdStringfunction id, related to the grid linked to the export
panelIdLonggrid identifier
filtersListlist of tuples [attr,op,value], related to filters to apply to the base enquiry
ordersListlist of tuples [attr,ASC/DESC], related to sorting conditions to apply to the base enquiry
attributesListlist of attributes, representing the whole columns
titlesListcolumn headers
titleStringexport file
toFileStringabsolute path, including the file name (.csv), where saving the exported data

sendAlertEmailFromTemplateWithConversationAndSMTPSettings​

Send an ALERT email to the specified destinations, starting from the specified templateId. Usernames are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithConversationAndSMTPSettings(
from, //String
templateId, //Number
destinations, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
conversationId, //Long
messageTag, //String
smtpHost, //String
smtpPort, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
useTLS, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringoptional sender username; if null, the current user or the template-defined sender is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsStringcomma-separated destination usernames whose email addresses are resolved by the platform.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
conversationIdLongoptional conversation identifier used to correlate the email with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
smtpHostStringSMTP server host used to send the email.
smtpPortStringSMTP server port; if empty, the mail subsystem default is used.
protocolStringmail transport protocol, typically smtp or smtps.
smtpUsernameStringSMTP username used for authenticated mail sessions; can be null for anonymous delivery.
smtpPasswordStringSMTP password paired with smtpUsername.
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
filesToAttachString[]additional attachment file paths to include in the email.

sendAlertEmailFromTemplateWithConversationAndSMTPSettings​

Send an ALERT email to the specified destinations, starting from the specified templateId. Usernames are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithConversationAndSMTPSettings(
from, //String
templateId, //Number
destinations, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
conversationId, //Long
messageTag, //String
smtpHost, //String
smtpPort, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
useTLS, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringoptional sender username; if null, the current user or the template-defined sender is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsStringcomma-separated destination usernames whose email addresses are resolved by the platform.
carbonCopyStringoptional comma-separated CC recipients.
blindCarbonCopyStringoptional comma-separated BCC recipients.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
conversationIdLongoptional conversation identifier used to correlate the email with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
smtpHostStringSMTP server host used to send the email.
smtpPortStringSMTP server port; if empty, the mail subsystem default is used.
protocolStringmail transport protocol, typically smtp or smtps.
smtpUsernameStringSMTP username used for authenticated mail sessions; can be null for anonymous delivery.
smtpPasswordStringSMTP password paired with smtpUsername.
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
filesToAttachString[]additional attachment file paths to include in the email.

sendAlertEmailFromTemplateWithConversationAndSMTPSettings​

Send an ALERT email to the specified destinations, starting from the specified templateId. Usernames are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithConversationAndSMTPSettings(
from, //String
templateId, //Number
destinations, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
conversationId, //Long
messageTag, //String
smtpHost, //String
smtpPort, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
useTLS, //String
dirId, //Long
fileName, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringoptional sender username; if null, the current user or the template-defined sender is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsStringcomma-separated destination usernames whose email addresses are resolved by the platform.
carbonCopyStringoptional comma-separated CC recipients.
blindCarbonCopyStringoptional comma-separated BCC recipients.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
conversationIdLongoptional conversation identifier used to correlate the email with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
smtpHostStringSMTP server host used to send the email.
smtpPortStringSMTP server port; if empty, the mail subsystem default is used.
protocolStringmail transport protocol, typically smtp or smtps.
smtpUsernameStringSMTP username used for authenticated mail sessions; can be null for anonymous delivery.
smtpPasswordStringSMTP password paired with smtpUsername.
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
dirIdLongoptional directory identifier where the generated EML message must be saved after sending.
fileNameStringoptional file name to use when saving the generated EML into dirId.
filesToAttachString[]additional attachment file paths to include in the email.

sendAlertEmailFromTemplateWithConversation​

Send an ALERT email to the specified destinations, starting from the specified templateId. Usernames are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithConversation(
from, //String
templateId, //Number
destinations, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
conversationId, //Long
messageTag, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringoptional sender username; if null, the current user or the template-defined sender is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsStringcomma-separated destination usernames whose email addresses are resolved by the platform.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
conversationIdLongoptional conversation identifier used to correlate the email with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
filesToAttachString[]additional attachment file paths to include in the email.

✅ Returns

true if the email was sent successfully, false otherwise


sendAlertEmailFromTemplateWithConversation​

Send an ALERT email to the specified destinations, starting from the specified templateId. Usernames are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithConversation(
from, //String
templateId, //Number
destinations, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
conversationId, //Long
messageTag, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringoptional sender username; if null, the current user or the template-defined sender is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsStringcomma-separated destination usernames whose email addresses are resolved by the platform.
carbonCopyStringoptional comma-separated CC recipients.
blindCarbonCopyStringoptional comma-separated BCC recipients.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
conversationIdLongoptional conversation identifier used to correlate the email with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
filesToAttachString[]additional attachment file paths to include in the email.

✅ Returns

true if the email was sent successfully, false otherwise


sendAlertEmailFromTemplateWithConversation​

Send an ALERT email to the specified destinations, starting from the specified templateId. Usernames are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithConversation(
from, //String
templateId, //Number
destinations, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
conversationId, //Long
messageTag, //String
dirId, //Long
fileName, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringoptional sender username; if null, the current user or the template-defined sender is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsStringcomma-separated destination usernames whose email addresses are resolved by the platform.
carbonCopyStringoptional comma-separated CC recipients.
blindCarbonCopyStringoptional comma-separated BCC recipients.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
conversationIdLongoptional conversation identifier used to correlate the email with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
dirIdLong(optional: can be null); directory ID for an additional attachment file
fileNameString(optional: can be null); file name within dirId to attach
filesToAttachString[]additional attachment file paths to include in the email.

✅ Returns

true if the email was sent successfully, false otherwise


sendAlertEmailFromTemplateWithEmailAddressesWithConversationAndSMTPSettings​

Send an ALERT email to the specified destinations, starting from the specified templateId. Email addresses are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithEmailAddressesWithConversationAndSMTPSettings(
fromEmail, //String
templateId, //Number
destinationsEmail, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
conversationId, //Long
messageTag, //String
smtpHost, //String
smtpPort, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
useTLS, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromEmailStringoptional sender email address; if null, the template-defined sender or current user email is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsEmailStringcomma-separated destination email addresses used directly without username resolution.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
conversationIdLongoptional conversation identifier used to correlate the email with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
smtpHostStringSMTP server host used to send the email.
smtpPortStringSMTP server port; if empty, the mail subsystem default is used.
protocolStringmail transport protocol, typically smtp or smtps.
smtpUsernameStringSMTP username used for authenticated mail sessions; can be null for anonymous delivery.
smtpPasswordStringSMTP password paired with smtpUsername.
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
filesToAttachString[]additional attachment file paths to include in the email.

sendAlertEmailFromTemplateWithEmailAddressesWithConversationAndSMTPSettings​

Send an ALERT email to the specified destinations, starting from the specified templateId. Email addresses are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithEmailAddressesWithConversationAndSMTPSettings(
fromEmail, //String
templateId, //Number
destinationsEmail, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
conversationId, //Long
messageTag, //String
smtpHost, //String
smtpPort, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
useTLS, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromEmailStringoptional sender email address; if null, the template-defined sender or current user email is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsEmailStringcomma-separated destination email addresses used directly without username resolution.
carbonCopyStringoptional comma-separated CC recipients.
blindCarbonCopyStringoptional comma-separated BCC recipients.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
conversationIdLongoptional conversation identifier used to correlate the email with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
smtpHostStringSMTP server host used to send the email.
smtpPortStringSMTP server port; if empty, the mail subsystem default is used.
protocolStringmail transport protocol, typically smtp or smtps.
smtpUsernameStringSMTP username used for authenticated mail sessions; can be null for anonymous delivery.
smtpPasswordStringSMTP password paired with smtpUsername.
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
filesToAttachString[]additional attachment file paths to include in the email.

sendAlertEmailFromTemplateWithEmailAddressesWithConversationAndSMTPSettings​

Send an ALERT email to the specified destinations, starting from the specified templateId. Email addresses are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithEmailAddressesWithConversationAndSMTPSettings(
fromEmail, //String
templateId, //Number
destinationsEmail, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
conversationId, //Long
messageTag, //String
smtpHost, //String
smtpPort, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
useTLS, //String
dirId, //Long
fileName, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromEmailStringoptional sender email address; if null, the template-defined sender or current user email is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsEmailStringcomma-separated destination email addresses used directly without username resolution.
carbonCopyStringoptional comma-separated CC recipients.
blindCarbonCopyStringoptional comma-separated BCC recipients.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
conversationIdLongoptional conversation identifier used to correlate the email with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
smtpHostStringSMTP server host used to send the email.
smtpPortStringSMTP server port; if empty, the mail subsystem default is used.
protocolStringmail transport protocol, typically smtp or smtps.
smtpUsernameStringSMTP username used for authenticated mail sessions; can be null for anonymous delivery.
smtpPasswordStringSMTP password paired with smtpUsername.
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
dirIdLongoptional directory identifier where the generated EML message must be saved after sending.
fileNameStringoptional file name to use when saving the generated EML into dirId.
filesToAttachString[]additional attachment file paths to include in the email.

sendAlertEmailFromTemplateWithEmailAddressesWithConversation​

Send an ALERT email to the specified destinations, starting from the specified templateId. Email addresses are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithEmailAddressesWithConversation(
fromEmail, //String
templateId, //Number
destinationsEmail, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
conversationId, //Long
messageTag, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromEmailStringoptional sender email address; if null, the template-defined sender or current user email is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsEmailStringcomma-separated destination email addresses used directly without username resolution.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
conversationIdLongoptional conversation identifier used to correlate the email with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
filesToAttachString[]additional attachment file paths to include in the email.

✅ Returns

true if the email was sent successfully, false otherwise


sendAlertEmailFromTemplateWithEmailAddressesWithConversation​

Send an ALERT email to the specified destinations, starting from the specified templateId. Email addresses are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithEmailAddressesWithConversation(
fromEmail, //String
templateId, //Number
destinationsEmail, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
conversationId, //Long
messageTag, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromEmailStringoptional sender email address; if null, the template-defined sender or current user email is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsEmailStringcomma-separated destination email addresses used directly without username resolution.
carbonCopyStringoptional comma-separated CC recipients.
blindCarbonCopyStringoptional comma-separated BCC recipients.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
conversationIdLongoptional conversation identifier used to correlate the email with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
filesToAttachString[]additional attachment file paths to include in the email.

✅ Returns

true if the email was sent successfully, false otherwise


sendAlertEmailFromTemplateWithEmailAddressesWithConversation​

Send an ALERT email to the specified destinations, starting from the specified templateId. Email addresses are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithEmailAddressesWithConversation(
fromEmail, //String
templateId, //Number
destinationsEmail, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
conversationId, //Long
messageTag, //String
dirId, //Long
fileName, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromEmailStringoptional sender email address; if null, the template-defined sender or current user email is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsEmailStringcomma-separated destination email addresses used directly without username resolution.
carbonCopyStringoptional comma-separated CC recipients.
blindCarbonCopyStringoptional comma-separated BCC recipients.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
conversationIdLongoptional conversation identifier used to correlate the email with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
dirIdLong(optional: can be null); directory ID for an additional attachment file
fileNameString(optional: can be null); file name within dirId to attach
filesToAttachString[]additional attachment file paths to include in the email.

✅ Returns

true if the email was sent successfully, false otherwise


sendAlertEmailFromTemplateWithEmailAddressesWithSMTPSettings​

Send an ALERT email to the specified destinations, starting from the specified templateId. Email addresses are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithEmailAddressesWithSMTPSettings(
fromEmail, //String
templateId, //Number
destinationsEmail, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
smtpHost, //String
smtpPort, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
useTLS, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromEmailStringoptional sender email address; if null, the template-defined sender or current user email is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsEmailStringcomma-separated destination email addresses used directly without username resolution.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
smtpHostStringSMTP server host used to send the email.
smtpPortStringSMTP server port; if empty, the mail subsystem default is used.
protocolStringmail transport protocol, typically smtp or smtps.
smtpUsernameStringSMTP username used for authenticated mail sessions; can be null for anonymous delivery.
smtpPasswordStringSMTP password paired with smtpUsername.
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
filesToAttachString[]additional attachment file paths to include in the email.

sendAlertEmailFromTemplateWithEmailAddressesWithSMTPSettings​

Send an ALERT email to the specified destinations, starting from the specified templateId. Email addresses are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithEmailAddressesWithSMTPSettings(
fromEmail, //String
templateId, //Number
destinationsEmail, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
smtpHost, //String
smtpPort, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
useTLS, //String
dirId, //Long
fileName, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromEmailStringoptional sender email address; if null, the template-defined sender or current user email is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsEmailStringcomma-separated destination email addresses used directly without username resolution.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
smtpHostStringSMTP server host used to send the email.
smtpPortStringSMTP server port; if empty, the mail subsystem default is used.
protocolStringmail transport protocol, typically smtp or smtps.
smtpUsernameStringSMTP username used for authenticated mail sessions; can be null for anonymous delivery.
smtpPasswordStringSMTP password paired with smtpUsername.
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
dirIdLongoptional directory identifier where the generated EML message must be saved after sending.
fileNameStringoptional file name to use when saving the generated EML into dirId.
filesToAttachString[]additional attachment file paths to include in the email.

sendAlertEmailFromTemplateWithEmailAddresses​

Send an ALERT email to the specified destinations, starting from the specified templateId. Email addresses are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithEmailAddresses(
fromEmail, //String
templateId, //Number
destinationsEmail, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromEmailStringoptional sender email address; if null, the template-defined sender or current user email is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsEmailStringcomma-separated destination email addresses used directly without username resolution.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
filesToAttachString[]additional attachment file paths to include in the email.

sendAlertEmailFromTemplateWithEmailAddresses​

Send an ALERT email to the specified destinations, starting from the specified templateId. Email addresses are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplateWithEmailAddresses(
fromEmail, //String
templateId, //Number
destinationsEmail, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
dirId, //Long
fileName, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromEmailStringoptional sender email address; if null, the template-defined sender or current user email is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsEmailStringcomma-separated destination email addresses used directly without username resolution.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
dirIdLongoptional directory identifier where the generated EML message must be saved after sending.
fileNameStringoptional file name to use when saving the generated EML into dirId.
filesToAttachString[]additional attachment file paths to include in the email.

sendAlertEmailFromTemplate​

Send an ALERT email to the specified destinations, starting from the specified templateId. Usernames are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplate(
from, //String
templateId, //Number
destinations, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringoptional sender username; if null, the current user or the template-defined sender is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsStringcomma-separated destination usernames whose email addresses are resolved by the platform.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
filesToAttachString[]additional attachment file paths to include in the email.

sendAlertEmailFromTemplate​

Send an ALERT email to the specified destinations, starting from the specified templateId. Usernames are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplate(
from, //String
templateId, //Number
destinations, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringoptional sender username; if null, the current user or the template-defined sender is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsStringcomma-separated destination usernames whose email addresses are resolved by the platform.
carbonCopyStringoptional comma-separated CC recipients.
blindCarbonCopyStringoptional comma-separated BCC recipients.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
filesToAttachString[]additional attachment file paths to include in the email.

sendAlertEmailFromTemplate​

Send an ALERT email to the specified destinations, starting from the specified templateId. Usernames are required for "from" and "destinations" arguments, which are both optionals. This id is used to fetch from CON52 a template in terms of subject and body and use them to send an email. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendAlertEmailFromTemplate(
from, //String
templateId, //Number
destinations, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
jsObj, //Map
dirId, //Long
fileName, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringoptional sender username; if null, the current user or the template-defined sender is used.
templateIdNumberidentifier of the CON52 template/button configuration used to resolve email subject and body.
destinationsStringcomma-separated destination usernames whose email addresses are resolved by the platform.
carbonCopyStringoptional comma-separated CC recipients.
blindCarbonCopyStringoptional comma-separated BCC recipients.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the resolved template body as HTML; false for plain text.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
dirIdLongoptional directory identifier where the generated EML message must be saved after sending.
fileNameStringoptional file name to use when saving the generated EML into dirId.
filesToAttachString[]additional attachment file paths to include in the email.

sendAlertEmailWithConversation​

Send an ALERT email to the specified destinations. Usernames are required for "from" and "destinations" arguments.

Syntax

//return boolean type
var risp = utils.sendAlertEmailWithConversation(
from, //String
subject, //String
message, //String
destinations, //String
priority, //String
isHtmlContent, //boolean
returnReceipt, //boolean
conversationId, //Long
messageTag, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringsender username; if null, the current user is used and its email address is resolved automatically.
subjectStringemail subject stored in the alert log and used for the outgoing email.
messageStringemail body content.
destinationsStringcomma-separated list of destination usernames whose email addresses will be resolved by the platform.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the message body as HTML; false to send it as plain text.
returnReceiptbooleantrue to request a read receipt from recipients.
conversationIdLongoptional conversation identifier used to correlate the email alert with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
filesToAttachString[]absolute server paths of additional files to attach to the outgoing email.

sendAlertEmailWithConversation​

Send an ALERT email to the specified destinations. Usernames are required for "from" and "destinations" arguments.

Syntax

//return boolean type
var risp = utils.sendAlertEmailWithConversation(
from, //String
subject, //String
message, //String
destinations, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
returnReceipt, //boolean
conversationId, //Long
messageTag, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringsender username; if null, the current user is used and its email address is resolved automatically.
subjectStringemail subject stored in the alert log and used for the outgoing email.
messageStringemail body content.
destinationsStringcomma-separated list of destination usernames whose email addresses will be resolved by the platform.
carbonCopyStringoptional comma-separated CC recipients passed directly to the outgoing email.
blindCarbonCopyStringoptional comma-separated BCC recipients passed directly to the outgoing email.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the message body as HTML; false to send it as plain text.
returnReceiptbooleantrue to request a read receipt from recipients.
conversationIdLongoptional conversation identifier used to correlate the email alert with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
filesToAttachString[]absolute server paths of additional files to attach to the outgoing email.

sendAlertEmailWithConversation​

Send an ALERT email to the specified destinations. Usernames are required for "from" and "destinations" arguments.

Syntax

//return boolean type
var risp = utils.sendAlertEmailWithConversation(
from, //String
subject, //String
message, //String
destinations, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
returnReceipt, //boolean
conversationId, //Long
messageTag, //String
dirId, //Long
fileName, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringsender username; if null, the current user is used and its email address is resolved automatically.
subjectStringemail subject stored in the alert log and used for the outgoing email.
messageStringemail body content.
destinationsStringcomma-separated list of destination usernames whose email addresses will be resolved by the platform.
carbonCopyStringoptional comma-separated CC recipients passed directly to the outgoing email.
blindCarbonCopyStringoptional comma-separated BCC recipients passed directly to the outgoing email.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the message body as HTML; false to send it as plain text.
returnReceiptbooleantrue to request a read receipt from recipients.
conversationIdLongoptional conversation identifier used to correlate the email alert with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
dirIdLongoptional directory identifier where the generated EML message must be saved after sending.
fileNameStringoptional file name to use when saving the generated EML into dirId.
filesToAttachString[]absolute server paths of additional files to attach to the outgoing email.

sendAlertEmailWithEmailAddressesWithConversation​

Send an ALERT email to the specified destinations. Email addresses are required for "from" and "destinations" arguments.

Syntax

//return boolean type
var risp = utils.sendAlertEmailWithEmailAddressesWithConversation(
fromEmail, //String
subject, //String
message, //String
destinationsEmail, //String
priority, //String
isHtmlContent, //boolean
returnReceipt, //boolean
conversationId, //Long
messageTag, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromEmailStringsender email address; if null, the current user email is used.
subjectStringemail subject stored in the alert log and used for the outgoing email.
messageStringemail body content.
destinationsEmailStringcomma-separated list of destination email addresses used directly without username resolution.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the message body as HTML; false to send it as plain text.
returnReceiptbooleantrue to request a read receipt from recipients.
conversationIdLongoptional conversation identifier used to correlate the email alert with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
filesToAttachString[]absolute server paths of additional files to attach to the outgoing email.

sendAlertEmailWithEmailAddressesWithConversation​

Send an ALERT email to the specified destinations. Email addresses are required for "from" and "destinations" arguments.

Syntax

//return boolean type
var risp = utils.sendAlertEmailWithEmailAddressesWithConversation(
fromEmail, //String
subject, //String
message, //String
destinationsEmail, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
returnReceipt, //boolean
conversationId, //Long
messageTag, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromEmailStringsender email address; if null, the current user email is used.
subjectStringemail subject stored in the alert log and used for the outgoing email.
messageStringemail body content.
destinationsEmailStringcomma-separated list of destination email addresses used directly without username resolution.
carbonCopyStringoptional comma-separated CC recipients passed directly to the outgoing email.
blindCarbonCopyStringoptional comma-separated BCC recipients passed directly to the outgoing email.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the message body as HTML; false to send it as plain text.
returnReceiptbooleantrue to request a read receipt from recipients.
conversationIdLongoptional conversation identifier used to correlate the email alert with an existing conversation.
messageTagStringoptional tag stored with the generated alert/email log entry.
filesToAttachString[]absolute server paths of additional files to attach to the outgoing email.

sendAlertEmailWithEmailAddresses​

Send an ALERT email to the specified destinations. Email addresses are required for "from" and "destinations" arguments.

Syntax

//return boolean type
var risp = utils.sendAlertEmailWithEmailAddresses(
fromEmail, //String
subject, //String
message, //String
destinationsEmail, //String
priority, //String
isHtmlContent, //boolean
returnReceipt, //boolean
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromEmailStringsender email address; if null, the current user email is used.
subjectStringemail subject stored in the alert log and used for the outgoing email.
messageStringemail body content.
destinationsEmailStringcomma-separated list of destination email addresses used directly without username resolution.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the message body as HTML; false to send it as plain text.
returnReceiptbooleantrue to request a read receipt from recipients.
filesToAttachString[]absolute server paths of additional files to attach to the outgoing email.

sendAlertEmail​

Send an ALERT email to the specified destinations. Usernames are required for "from" and "destinations" arguments.

Syntax

//return boolean type
var risp = utils.sendAlertEmail(
from, //String
subject, //String
message, //String
destinations, //String
priority, //String
isHtmlContent, //boolean
returnReceipt, //boolean
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringsender username; if null, the current user is used and its email address is resolved automatically.
subjectStringemail subject stored in the alert log and used for the outgoing email.
messageStringemail body content.
destinationsStringcomma-separated list of destination usernames whose email addresses will be resolved by the platform.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the message body as HTML; false to send it as plain text.
returnReceiptbooleantrue to request a read receipt from recipients.
filesToAttachString[]absolute server paths of additional files to attach to the outgoing email.

sendAlertEmail​

Send an ALERT email to the specified destinations. Usernames are required for "from" and "destinations" arguments.

Syntax

//return boolean type
var risp = utils.sendAlertEmail(
from, //String
subject, //String
message, //String
destinations, //String
carbonCopy, //String
blindCarbonCopy, //String
priority, //String
isHtmlContent, //boolean
returnReceipt, //boolean
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromStringsender username; if null, the current user is used and its email address is resolved automatically.
subjectStringemail subject stored in the alert log and used for the outgoing email.
messageStringemail body content.
destinationsStringcomma-separated list of destination usernames whose email addresses will be resolved by the platform.
carbonCopyStringoptional comma-separated CC recipients passed directly to the outgoing email.
blindCarbonCopyStringoptional comma-separated BCC recipients passed directly to the outgoing email.
priorityStringemail priority stored in the alert log; if null, the platform default priority is used.
isHtmlContentbooleantrue to send the message body as HTML; false to send it as plain text.
returnReceiptbooleantrue to request a read receipt from recipients.
filesToAttachString[]absolute server paths of additional files to attach to the outgoing email.

sendAlertMessage​

Sends an ALERT message to the specified destinations. This is a convenience overload that delegates to String, String, String, Long, String) with no conversationId and no messageTag.

Syntax

//return boolean type
var risp = utils.sendAlertMessage(
from, //String
message, //String
siteId, //Long
destination, //String
priority, //String
conversationId, //Long
messageTag //String
);

Details

ArgumentTypeDescription
fromStringsender username; if null, the current user's username is used
messageStringthe message content to send
siteIdLongtarget site identifier used to route the alert within a specific site context.
destinationStringdestination username that must receive the alert inside the specified site.
priorityStringmessage priority; if null, normal priority is used
conversationIdLongoptional conversation identifier used to group the alert inside an existing thread.
messageTagStringoptional tag stored with the alert for later conversation lookups or client-side routing.

✅ Returns

true if the message was sent successfully


sendAlertMessage​

Sends an ALERT message to the specified destinations. This is a convenience overload that delegates to String, String, String, Long, String) with no conversationId and no messageTag.

Syntax

//return boolean type
var risp = utils.sendAlertMessage(
from, //String
message, //String
destinations, //String
priority, //String
conversationId, //Long
messageTag //String
);

Details

ArgumentTypeDescription
fromStringsender username; if null, the current user's username is used
messageStringthe message content to send
destinationsStringcomma-separated list of destination usernames
priorityStringmessage priority; if null, normal priority is used
conversationIdLongoptional conversation identifier used to group the alert inside an existing thread.
messageTagStringoptional tag stored with the alert for later conversation lookups or client-side routing.

✅ Returns

true if the message was sent successfully


sendAlertMessage​

Sends an ALERT message to the specified destinations. This is a convenience overload that delegates to String, String, String, Long, String) with no conversationId and no messageTag.

Syntax

//return boolean type
var risp = utils.sendAlertMessage(
from, //String
message, //String
destinations, //String
priority //String
);

Details

ArgumentTypeDescription
fromStringsender username; if null, the current user's username is used
messageStringthe message content to send
destinationsStringcomma-separated list of destination usernames
priorityStringmessage priority; if null, normal priority is used

✅ Returns

true if the message was sent successfully


sendChatMessage​

Send a CHAT message to the specified destinations.

Syntax

//return boolean type
var risp = utils.sendChatMessage(
from, //String
message, //String
destinations, //String
priority, //String
conversationId, //Long
messageTag //String
);

Details

ArgumentTypeDescription
fromStringsender username; if null, the current logged user is used.
messageStringmessage text/body to send through the collaboration log channel.
destinationsStringcomma-separated list of destination usernames.
priorityStringmessage priority; if null, the platform normal priority is used.
conversationIdLongoptional conversation identifier used to group the message inside an existing thread.
messageTagStringoptional tag stored with the message for later conversation lookups or client-side routing.

sendChatMessage​

Send a CHAT message to the specified destinations.

Syntax

//return boolean type
var risp = utils.sendChatMessage(
from, //String
message, //String
destinations, //String
priority //String
);

Details

ArgumentTypeDescription
fromStringsender username; if null, the current logged user is used.
messageStringmessage text/body to send through the collaboration log channel.
destinationsStringcomma-separated list of destination usernames.
priorityStringmessage priority; if null, the platform normal priority is used.

sendEmailWithMessageTemplateWithSettings​

Send an email to the specified destinations, starting from the specified template. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendEmailWithMessageTemplateWithSettings(
subject, //String
messageTemplate, //String
jsObj, //Map
from, //String
to, //String
cc, //String
bcc, //String
priority, //String
isHtmlContent, //Boolean
returnReceipt, //Boolean
smtpHost, //String
smtpPort, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
useTLS, //String
zipFiles, //Boolean
additionalSettings, //Map
dirId, //Long
filesToAttach //String[]
);

Details

ArgumentTypeDescription
subjectStringemail subject used together with the message template.
messageTemplateStringemail body template; variables expressed as :NAME are replaced using values from jsObj/vars before sending.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
fromStringsender email address to use when sending the message.
toStringcomma-separated destination email addresses.
ccStringcomma-separated carbon-copy email addresses.
bccStringcomma-separated blind-carbon-copy email addresses.
priorityStringemail priority to associate with the generated alert/log entry.
isHtmlContentBooleantrue to send the resolved template body as HTML; false for plain text.
returnReceiptBooleantrue to request a read receipt from recipients.
smtpHostStringSMTP server host used to send the email.
smtpPortStringSMTP server port; if empty, the mail subsystem default is used.
protocolStringmail transport protocol, typically smtp or smtps.
smtpUsernameStringSMTP username used for authenticated mail sessions; can be null for anonymous delivery.
smtpPasswordStringSMTP password paired with smtpUsername.
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
zipFilesBooleantrue to compress attachments into a single ZIP before sending.
additionalSettingsMapcan be null; if specified, it contains additional settings helpful for additional tasks. Content of additionalSettings: { elmDirId = elmFileName: "filename.elm" }
dirIdLongoptional platform directory identifier used to resolve attachment names from filesToAttach.
filesToAttachString[]attachment names/paths to send; when dirId is provided they are read from that directory, otherwise they are treated as absolute paths.

sendEmailWithMessageTemplate​

Send an email to the specified destinations, starting from the specified template. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendEmailWithMessageTemplate(
subject, //String
messageTemplate, //String
jsObj, //Map
from, //String
to, //String
cc, //String
bcc, //String
priority, //String
isHtmlContent, //Boolean
returnReceipt, //Boolean
smtpHost, //String
smtpPort, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
useTLS, //String
zipFiles, //Boolean
dirId, //Long
filesToAttach //String[]
);

Details

ArgumentTypeDescription
subjectStringemail subject used together with the message template.
messageTemplateStringemail body template; variables expressed as :NAME are replaced using values from jsObj/vars before sending.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
fromStringsender email address to use when sending the message.
toStringcomma-separated destination email addresses.
ccStringcomma-separated carbon-copy email addresses.
bccStringcomma-separated blind-carbon-copy email addresses.
priorityStringemail priority to associate with the generated alert/log entry.
isHtmlContentBooleantrue to send the resolved template body as HTML; false for plain text.
returnReceiptBooleantrue to request a read receipt from recipients.
smtpHostStringSMTP server host used to send the email.
smtpPortStringSMTP server port; if empty, the mail subsystem default is used.
protocolStringmail transport protocol, typically smtp or smtps.
smtpUsernameStringSMTP username used for authenticated mail sessions; can be null for anonymous delivery.
smtpPasswordStringSMTP password paired with smtpUsername.
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
zipFilesBooleantrue to compress attachments into a single ZIP before sending.
dirIdLongoptional platform directory identifier used to resolve attachment names from filesToAttach.
filesToAttachString[]attachment names/paths to send; when dirId is provided they are read from that directory, otherwise they are treated as absolute paths.

sendEmailWithSMTPSettings​

Send an email.

Syntax

utils.sendEmailWithSMTPSettings(
from, //String
to, //String
cc, //String
bcc, //String
subject, //String
body, //String
isHtmlContent, //Boolean
returnReceipt, //Boolean
zipFiles, //Boolean
deleteFilesAfterSending, //Boolean
smtpHost, //String
smtpPort, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
useTLS, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromString(optional, can be null) a string representing the email address to use as the "from address" to send the email
toStringa string composed of one or more email addresses, separated by a comma (,)
ccString(carbon copy addresses) a string composed of one or more email addresses, separated by a comma (,)
bccString(hidden addresses) a string composed of one or more email addresses, separated by a comma (,)
subjectStringa string representing the email title
bodyStringthe email body content
isHtmlContentBooleana boolean flag used to define if the body content is in HTML format or not
returnReceiptBooleana boolean flag used to request a return receipt to the destinators
zipFilesBooleana boolean flag used to compress all files to attach in a unique zip file and send it, in order to reduce the email size
deleteFilesAfterSendingBooleana boolean flag used to optionally delete files to attach, after sending the email
smtpHostStringSMTP server host used to send the email.
smtpPortStringSMTP server port; if empty, the mail subsystem default is used.
protocolStringmail transport protocol, typically smtp or smtps.
smtpUsernameStringSMTP username used for authenticated mail sessions; can be null for anonymous delivery.
smtpPasswordStringSMTP password paired with smtpUsername.
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
filesToAttachString[]a list of files to attach, separated by a comma; use [] to not include files; each file must include the absolute path

⚠️ Throws

  • Throwable in case of errors when sending the email (e.g. attachment file not found)

sendEmailWithSMTPSettings​

Send an email.

Syntax

utils.sendEmailWithSMTPSettings(
from, //String
to, //String
cc, //String
bcc, //String
subject, //String
body, //String
isHtmlContent, //Boolean
returnReceipt, //Boolean
zipFiles, //Boolean
deleteFilesAfterSending, //Boolean
smtpHost, //String
smtpPort, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
useTLS, //String
dirId, //Long
fileName, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromString(optional, can be null) a string representing the email address to use as the "from address" to send the email
toStringa string composed of one or more email addresses, separated by a comma (,)
ccString(carbon copy addresses) a string composed of one or more email addresses, separated by a comma (,)
bccString(hidden addresses) a string composed of one or more email addresses, separated by a comma (,)
subjectStringa string representing the email title
bodyStringthe email body content
isHtmlContentBooleana boolean flag used to define if the body content is in HTML format or not
returnReceiptBooleana boolean flag used to request a return receipt to the destinators
zipFilesBooleana boolean flag used to compress all files to attach in a unique zip file and send it, in order to reduce the email size
deleteFilesAfterSendingBooleana boolean flag used to optionally delete files to attach, after sending the email
smtpHostStringSMTP server host used to send the email.
smtpPortStringSMTP server port; if empty, the mail subsystem default is used.
protocolStringmail transport protocol, typically smtp or smtps.
smtpUsernameStringSMTP username used for authenticated mail sessions; can be null for anonymous delivery.
smtpPasswordStringSMTP password paired with smtpUsername.
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
dirIdLongoptional directory identifier where the generated EML message must be saved after sending.
fileNameStringoptional file name to use when saving the generated EML into dirId.
filesToAttachString[]a list of files to attach, separated by a comma; use [] to not include files; each file must include the absolute path

⚠️ Throws

  • Throwable in case of errors when sending the email (e.g. attachment file not found)

sendEmailWithSettings​

Send an email, by using the specified SMTP server and settings.

Syntax

utils.sendEmailWithSettings(
smtpHost, //String
smtpPort, //String
useTLS, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
from, //String
to, //String
cc, //String
bcc, //String
subject, //String
body, //String
isHtmlContent, //Boolean
returnReceipt, //Boolean
zipFiles, //Boolean
deleteFilesAfterSending, //Boolean
settings, //HashMap
filesToAttach //String[]
);

Details

ArgumentTypeDescription
smtpHostStringSMTP host
smtpPortStringSMTP port
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
protocolStringSMTP/SMTPS
smtpUsernameStringSMTP username
smtpPasswordStringSMTP password
fromString(optional, can be null) a string representing the email address to use as the "from address" to send the email
toStringa string composed of one or more email addresses, separated by a comma (,)
ccString(carbon copy addresses) a string composed of one or more email addresses, separated by a comma (,)
bccString(hidden addresses) a string composed of one or more email addresses, separated by a comma (,)
subjectStringa string representing the email title
bodyStringthe email body content
isHtmlContentBooleana boolean flag used to define if the body content is in HTML format or not
returnReceiptBooleana boolean flag used to request a return receipt to the destinators
zipFilesBooleana boolean flag used to compress all files to attach in a unique zip file and send it, in order to reduce the email size
deleteFilesAfterSendingBooleana boolean flag used to optionally delete files to attach, after sending the email
settingsHashMapoptional additional JavaMail properties merged into the SMTP session before sending; keys and values must match JavaMail property names such as mail.smtp.ssl.trust or mail.smtp.starttls.required.
filesToAttachString[]a list of files to attach, separated by a comma; use [] to not include files; each file must include the absolute path

⚠️ Throws

  • Throwable in case of errors when sending the email (e.g. attachment file not found) @parram useTLS flag Y/N used to define weather TLS must be used

sendEmailWithTemplate​

Send an email to the specified destinations, starting from the specified template. When using template's subject and form, if these contain variables :XXX, they will be replaced.

Syntax

//return boolean type
var risp = utils.sendEmailWithTemplate(
subject, //String
templateId, //Long
jsObj, //Map
from, //String
to, //String
cc, //String
bcc, //String
priority, //String
isHtmlContent, //Boolean
returnReceipt, //Boolean
zipFiles, //Boolean
dirId, //Long
filesToAttach //String[]
);

Details

ArgumentTypeDescription
subjectStringdefault email subject to use before applying template overrides; it can be replaced by the template subject defined in CON52.
templateIdLongidentifier of the CON52 email template/button configuration from which subject, body, sender, recipients, and receipt options are loaded.
jsObjMapmap of template variables used for :PLACEHOLDER replacement; top-level entries become variables with the same name, nested maps become dotted variables such as parent.child, and PRINT_VARS="Y" enables variable logging before sending.
fromStringdefault sender email address; it can be overridden by the template definition.
toStringdefault comma-separated recipient email addresses; it can be overridden by the template definition.
ccStringdefault comma-separated carbon-copy email addresses; it can be overridden by the template definition.
bccStringdefault comma-separated blind-carbon-copy email addresses; it can be overridden by the template definition.
priorityStringemail priority to store in the alert log entry; if null, the platform default priority is used.
isHtmlContentBooleantrue to send the resolved template body as HTML; false to send it as plain text.
returnReceiptBooleandefault read-receipt flag; it can be overridden by the template setting.
zipFilesBooleantrue to compress the attachments into a single ZIP before sending.
dirIdLongoptional platform directory identifier used to resolve attachment names from filesToAttach.
filesToAttachString[]attachment names/paths to include in the email; when dirId is set they are treated as file names inside that platform directory, otherwise they are interpreted as absolute server paths.

sendEmail​

Send an email.

Syntax

//return Message type
var risp = utils.sendEmail(
from, //String
to, //String
cc, //String
bcc, //String
subject, //String
body, //String
isHtmlContent, //Boolean
returnReceipt, //Boolean
zipFiles, //Boolean
deleteFilesAfterSending, //Boolean
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromString(optional, can be null) a string representing the email address to use as the "from address" to send the email
toStringa string composed of one or more email addresses, separated by a comma (,)
ccString(carbon copy addresses) a string composed of one or more email addresses, separated by a comma (,)
bccString(hidden addresses) a string composed of one or more email addresses, separated by a comma (,)
subjectStringa string representing the email title
bodyStringthe email body content
isHtmlContentBooleana boolean flag used to define if the body content is in HTML format or not
returnReceiptBooleana boolean flag used to request a return receipt to the destinators
zipFilesBooleana boolean flag used to compress all files to attach in a unique zip file and send it, in order to reduce the email size
deleteFilesAfterSendingBooleana boolean flag used to optionally delete files to attach, after sending the email
filesToAttachString[]a list of files to attach, separated by a comma; use [] to not include files; each file must include the absolute path

⚠️ Throws

  • Throwable in case of errors when sending the email (e.g. attachment file not found)

sendEmail​

Send an email.

Syntax

//return Message type
var risp = utils.sendEmail(
from, //String
to, //String
cc, //String
bcc, //String
subject, //String
body, //String
isHtmlContent, //Boolean
returnReceipt, //Boolean
zipFiles, //Boolean
deleteFilesAfterSending, //Boolean
dirId, //Long
fileName, //String
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromString(optional, can be null) a string representing the email address to use as the "from address" to send the email
toStringa string composed of one or more email addresses, separated by a comma (,)
ccString(carbon copy addresses) a string composed of one or more email addresses, separated by a comma (,)
bccString(hidden addresses) a string composed of one or more email addresses, separated by a comma (,)
subjectStringa string representing the email title
bodyStringthe email body content
isHtmlContentBooleana boolean flag used to define if the body content is in HTML format or not
returnReceiptBooleana boolean flag used to request a return receipt to the destinators
zipFilesBooleana boolean flag used to compress all files to attach in a unique zip file and send it, in order to reduce the email size
deleteFilesAfterSendingBooleana boolean flag used to optionally delete files to attach, after sending the email
dirIdLongoptional directory identifier where the generated EML message must be saved after sending; use null to skip EML persistence.
fileNameStringoptional file name to use when saving the generated EML into dirId; ignored when dirId is null or empty.
filesToAttachString[]a list of files to attach, separated by a comma; use [] to not include files; each file must include the absolute path

⚠️ Throws

  • Throwable in case of errors when sending the email (e.g. attachment file not found)

sendEmail​

Send an email.

Syntax

utils.sendEmail(
smtpHost, //String
smtpPort, //String
useTLS, //String
protocol, //String
smtpUsername, //String
smtpPassword, //String
from, //String
to, //String
cc, //String
bcc, //String
subject, //String
body, //String
isHtmlContent, //Boolean
returnReceipt, //Boolean
zipFiles, //Boolean
deleteFilesAfterSending, //Boolean
filesToAttach //String[]
);

Details

ArgumentTypeDescription
smtpHostStringSMTP host
smtpPortStringSMTP port
useTLSStringTLS mode flag passed to the mail sender: E enables STARTTLS, F forces it, any other value leaves it disabled.
protocolStringSMTP/SMTPS
smtpUsernameStringSMTP username
smtpPasswordStringSMTP password
fromString(optional, can be null) a string representing the email address to use as the "from address" to send the email
toStringa string composed of one or more email addresses, separated by a comma (,)
ccString(carbon copy addresses) a string composed of one or more email addresses, separated by a comma (,)
bccString(hidden addresses) a string composed of one or more email addresses, separated by a comma (,)
subjectStringa string representing the email title
bodyStringthe email body content
isHtmlContentBooleana boolean flag used to define if the body content is in HTML format or not
returnReceiptBooleana boolean flag used to request a return receipt to the destinators
zipFilesBooleana boolean flag used to compress all files to attach in a unique zip file and send it, in order to reduce the email size
deleteFilesAfterSendingBooleana boolean flag used to optionally delete files to attach, after sending the email
filesToAttachString[]a list of files to attach, separated by a comma; use [] to not include files; each file must include the absolute path

⚠️ Throws

  • Throwable in case of errors when sending the email (e.g. attachment file not found)

sendFile [Deprecated]​

Send a single file to the FTP server and store it in the specified folder with the specified name.

Syntax

//return boolean type
var risp = utils.sendFile(
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
destFile, //String
directoryId, //Long
fileName //String
);

Details

ArgumentTypeDescription
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
destFileStringfolder in the FTP server + destination file name where storing the file
directoryIdLongdirectory id directory identifier, used to define the absolute path, in the central server, where the file will be stored; if null, there must be one only entry for this application
fileNameStringfile name; it can includes a subpath to append to the base path specified through directoryId

✅ Returns

true if the file has been stored within the FTP server correctly


sendFile [Deprecated]​

Send a single file to the FTP server and store it in the specified folder with the specified name.

Syntax

//return boolean type
var risp = utils.sendFile(
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
destFile, //String
sourceFile //String
);

Details

ArgumentTypeDescription
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
destFileStringfolder in the FTP server + destination file name where storing the file
sourceFileStringabsolute path in the server file system + file name, related to the file to read

✅ Returns

true if the file has been stored within the FTP server correctly


sendFile​

Send a single file to the FTP server and store it in the specified folder with the specified name.

Syntax

//return boolean type
var risp = utils.sendFile(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
destFile, //String
directoryId, //Long
fileName, //String
sessionTimeout //Integer
);

Details

ArgumentTypeDescription
protocolStringthe FTP protocol type (e.g. "FTP", "FTPS", "SFTP")
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
destFileStringfolder in the FTP server + destination file name where storing the file
directoryIdLongdirectory id directory identifier, used to define the absolute path, in the central server, where the file will be stored; if null, there must be one only entry for this application
fileNameStringfile name; it can includes a subpath to append to the base path specified through directoryId
sessionTimeoutIntegerseconds of timeout for the FTP session (nullable)

✅ Returns

true if the file has been stored within the FTP server correctly


sendFile​

Send a single file to the FTP server and store it in the specified folder with the specified name.

Syntax

//return boolean type
var risp = utils.sendFile(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
destFile, //String
directoryId, //Long
fileName //String
);

Details

ArgumentTypeDescription
protocolStringthe FTP protocol type (e.g. "FTP", "FTPS", "SFTP")
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
destFileStringfolder in the FTP server + destination file name where storing the file
directoryIdLongdirectory id directory identifier, used to define the absolute path, in the central server, where the file will be stored; if null, there must be one only entry for this application
fileNameStringfile name; it can includes a subpath to append to the base path specified through directoryId

✅ Returns

true if the file has been stored within the FTP server correctly


sendFile​

Send a single file to the FTP server and store it in the specified folder with the specified name.

Syntax

//return boolean type
var risp = utils.sendFile(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
destFile, //String
sourceFile, //String
sessionTimeout //Integer
);

Details

ArgumentTypeDescription
protocolStringthe FTP protocol type (e.g. "FTP", "FTPS", "SFTP")
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
destFileStringfolder in the FTP server + destination file name where storing the file
sourceFileStringabsolute path in the server file system + file name, related to the file to read
sessionTimeoutIntegerseconds of timeout for the FTP session (nullable)

✅ Returns

true if the file has been stored within the FTP server correctly


sendFile​

Send a single file to the FTP server and store it in the specified folder with the specified name.

Syntax

//return boolean type
var risp = utils.sendFile(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
destFile, //String
sourceFile //String
);

Details

ArgumentTypeDescription
protocolStringthe FTP protocol type (e.g. "FTP", "FTPS", "SFTP")
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
destFileStringfolder in the FTP server + destination file name where storing the file
sourceFileStringabsolute path in the server file system + file name, related to the file to read

✅ Returns

true if the file has been stored within the FTP server correctly


sendFiles [Deprecated]​

Send one or more files to the FTP server and store them in the specified folder.

Syntax

//return boolean type
var risp = utils.sendFiles(
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
toDir, //String
filePaths //String[]
);

Details

ArgumentTypeDescription
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
toDirStringfolder in the FTP server where storing the file
filePathsString[]list of absolute paths in the server file system + file names

✅ Returns

true if the file has been stored within the FTP server correctly


sendFiles​

Send one or more files to the FTP server and store them in the specified folder.

Syntax

//return boolean type
var risp = utils.sendFiles(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
toDir, //String
filePaths //String[]
);

Details

ArgumentTypeDescription
protocolStringFTP protocol type to use for the connection, for example FTP, FTPS, or SFTP.
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
toDirStringfolder in the FTP server where storing the file
filePathsString[]list of absolute paths in the server file system + file names

✅ Returns

true if the file has been stored within the FTP server correctly


sendFiles​

Send one or more files to the FTP server and store them in the specified folder.

Syntax

//return boolean type
var risp = utils.sendFiles(
protocol, //String
host, //String
port, //Integer
useSSL, //Boolean
username, //String
password, //String
toDir, //String
sessionTimeout, //Integer
filePaths //String[]
);

Details

ArgumentTypeDescription
protocolStringFTP protocol type to use for the connection, for example FTP, FTPS, or SFTP.
hostStringFTP server host
portIntegerFTP server port
useSSLBooleanflag used to open a secure connection with the FTP server
usernameStringusername to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
passwordStringpassword to use when authenticating to the FTP server (optional: if not specified, an anonymous user will be used)
toDirStringfolder in the FTP server where storing the file
sessionTimeoutIntegerseconds of timeout session
filePathsString[]list of absolute paths in the server file system + file names

✅ Returns

true if the file has been stored within the FTP server correctly


sendGmail​

Send an email using GMail APIs.

Syntax

//return EmailMessage type
var risp = utils.sendGmail(
from, //String
to, //String
cc, //String
bcc, //String
subject, //String
body, //String
isHtmlContent, //Boolean
returnReceipt, //Boolean
zipFiles, //Boolean
deleteFilesAfterSending, //Boolean
filesToAttach //String[]
);

Details

ArgumentTypeDescription
fromString(optional, can be null) a string representing the email address to use as the "from address" to send the email
toStringa string composed of one or more email addresses, separated by a comma (,)
ccString(carbon copy addresses) a string composed of one or more email addresses, separated by a comma (,)
bccString(hidden addresses) a string composed of one or more email addresses, separated by a comma (,)
subjectStringa string representing the email title
bodyStringthe email body content
isHtmlContentBooleana boolean flag used to define if the body content is in HTML format or not
returnReceiptBooleana boolean flag used to request a return receipt to the destinators
zipFilesBooleana boolean flag used to compress all files to attach in a unique zip file and send it, in order to reduce the email size
deleteFilesAfterSendingBooleana boolean flag used to optionally delete files to attach, after sending the email
filesToAttachString[]a list of files to attach, separated by a comma; use [] to not include files; each file must include the absolute path

⚠️ Throws

  • Throwable in case of errors when sending the email (e.g. attachment file not found)

sendJavascriptMessage​

Send a JavaScript message to the specified destinations, which will be forwarded to a client-side JavaScript callback function. The message is delivered via the platform's alert/notification system.

Syntax

//return boolean type
var risp = utils.sendJavascriptMessage(
from, //String
obj, //Map
siteId, //Long
destination, //String
functionName //String
);

Details

ArgumentTypeDescription
fromStringusername of the sender (optional: can be null, defaults to the current user)
objMapa Map<String, Object> representing the JavaScript object to send as the message payload. Keys and values are arbitrary and application-specific — they are serialized to JSON and passed to the client-side callback function. Can be null (empty message body)
siteIdLongthe site ID to target for message delivery
destinationStringthe destination username
functionNameStringthe client-side JavaScript function name that will be invoked on the recipients' browser with the deserialized message object as argument

✅ Returns

always returns true (message is enqueued regardless of delivery success)


sendJavascriptMessage​

Send a JavaScript message to the specified destinations, which will be forwarded to a client-side JavaScript callback function. The message is delivered via the platform's alert/notification system.

Syntax

//return boolean type
var risp = utils.sendJavascriptMessage(
from, //String
obj, //Map
destinations, //String
functionName //String
);

Details

ArgumentTypeDescription
fromStringusername of the sender (optional: can be null, defaults to the current user)
objMapa Map<String, Object> representing the JavaScript object to send as the message payload. Keys and values are arbitrary and application-specific — they are serialized to JSON and passed to the client-side callback function. Can be null (empty message body)
destinationsStringcomma-separated list of destination usernames
functionNameStringthe client-side JavaScript function name that will be invoked on the recipients' browser with the deserialized message object as argument

✅ Returns

always returns true (message is enqueued regardless of delivery success)


setApplicationId​

Overrides the application ID in the current user session. For security reasons, this operation is only allowed when the current application is "DESIGNER" (i.e., the user is a developer in App Designer).

Syntax

utils.setApplicationId(
appId //String
);

Details

ArgumentTypeDescription
appIdStringthe new application ID to set

setAttributeValue​

Set the value for the specified attribute name, related to the input object.

Syntax

utils.setAttributeValue(
attributeName, //String
value //Object
);

Details

ArgumentTypeDescription
attributeNameStringattribute name contained in the input object
valueObjectvalue to set

setCompanyId​

Set company id to use in UserInfo. The companyId setting is allowed ONLY IF the current companyId value is undefined, as in case of an action invoked by a queue.

Syntax

utils.setCompanyId(
companyId //String
);

Details

ArgumentTypeDescription
companyIdString

setContentType​

Sets the content type for the HTTP response of the current web service call.

Syntax

utils.setContentType(
contentType //String
);

Details

ArgumentTypeDescription
contentTypeStringthe MIME content type (e.g. "application/json", "text/xml")

setContextValue​

Set a variabile in the js context.

Syntax

utils.setContextValue(
varName, //String
varValue //String
);

Details

ArgumentTypeDescription
varNameStringJavaScript context variable name to set; dotted notation can be used to target nested map properties.
varValueStringstring value to assign to the specified JavaScript context variable.

setDecodeField​

Set the corresponding table.field name for the specified attribute, coming from the grid, included in the filtering/sorting conditions.

Syntax

utils.setDecodeField(
attributeName, //String
fieldName //String
);

Details

ArgumentTypeDescription
attributeNameStringattribute name to decode
fieldNameStringtable.field name to use instead of the attribute

setDecodeOperator​

Override the default SQL operator used for filtering on the specified attribute in the filtering conditions generated by getPartialResult and related methods. Works in conjunction with String) and Boolean).

Syntax

utils.setDecodeOperator(
attributeName, //String
operator //String
);

Details

ArgumentTypeDescription
attributeNameStringthe grid attribute name whose operator should be overridden
operatorStringthe SQL operator to use (e.g., "=", "LIKE", ">", "<", "IN", "IS NULL")

setDecodeUpperCase​

Set whether the filtering condition for the specified attribute should apply UPPER() to the field value, enabling case-insensitive comparisons in the filtering conditions generated by getPartialResult and related methods. Works in conjunction with String) and String).

Syntax

utils.setDecodeUpperCase(
attributeName, //String
uppercase //Boolean
);

Details

ArgumentTypeDescription
attributeNameStringthe grid attribute name whose case sensitivity should be configured
uppercaseBooleanif true, applies UPPER() to the field for case-insensitive matching; if false, uses the field value as-is

setElaborationState​

Set the final elaboration state for the linked monitored service.

Syntax

utils.setElaborationState(
elaborationState, //String
result //String
);

Details

ArgumentTypeDescription
elaborationStateStringfinal monitored-service state to persist, for example OK or KO.
resultStringresult text/details to store together with the final elaboration state.

setHttpResponseCode​

Sets the HTTP response code for the current web service response.

Syntax

utils.setHttpResponseCode(
httpResponseCode //int
);

Details

ArgumentTypeDescription
httpResponseCodeintthe HTTP status code (e.g. 200, 404, 500)

setImagesInXls​

Open an already existing xls file and save an image within a cell, starting from an image from the file system. By and large, a list of images can be saved.

Syntax

utils.setImagesInXls(
dirId, //Long
srcFileName, //String
destFileName, //String
sheetName, //String
images //Map>
);

Details

ArgumentTypeDescription
dirIdLongpath identifier
srcFileNameStringname of the existing source Excel file to read from the specified directory.
destFileNameStringname of the destination Excel file to create/update with the injected images.
sheetNameStringfolder inside the spreadsheet
imagesMap>list of objects having the following content: { x: 0, y: 0, w: 10, h: 1000, imagePath: "/opt/a.jpg" } Allowed image formats are: png and jpg

setLineToPDFFile​

Writes a line of text at an absolute position (x, y) on the current page of an already opened PDF file. Unlike String, Map), this method does not advance a cursor or trigger automatic pagination — it places text exactly where specified. If no page has been added yet, one is created automatically via addPageToPDFFile. The Euro sign (€, U+20AC) is automatically converted to its WinAnsi encoding equivalent.

Syntax

utils.setLineToPDFFile(
uuid, //String
x, //int
y, //int
line, //String
settings //Map
);

Details

ArgumentTypeDescription
uuidStringthe output stream identifier returned by Long, Map)
xintX coordinate in points (from left to right)
yintY coordinate in points (from bottom to top; 0 is the bottom of the page)
lineStringthe text content to write
settingsMapconfiguration map for font rendering. Supported keys: (details below)

settings​

configuration map for font rendering. Supported keys:

  • "fontName" (String) — font alias (loaded via String, String)) or a standard PDF font name (e.g., "Courier", "Helvetica-Bold", "Times-Roman"). If the alias is not found among loaded fonts, it falls back to a standard PDType1Font.
  • "fontSize" (Number) — font size in points (default: 10)

⚠️ Throws

  • Throwable if writing to the PDF fails
  • RuntimeException if the PDF file has not been opened (uuid not found)

setPassword​

Overrides the password in the current internal state.

Syntax

utils.setPassword(
pwd //String
);

Details

ArgumentTypeDescription
pwdStringthe new password to set

setReturnValue​

Sets the return value to be sent back to the client after the server-side action completes. If the value is a String, it is stored as-is.

Syntax

utils.setReturnValue(
returnValue //Object
);

Details

ArgumentTypeDescription
returnValueObjectthe value to return to the client; can be any object type (String, Map, List, etc.)

setSiteId​

Overrides the site ID in the current user session. Updates both the UserInfo object (via reflection) and the session variable SITE_ID.

Syntax

utils.setSiteId(
siteId //Long
);

Details

ArgumentTypeDescription
siteIdLongthe new site ID to set @implNote Uses reflection to invoke UserInfo.setSiteId(Long) since the method may not be available at compile time on all UserInfo implementations.

setUsername​

Overrides the username in the current user session.

Syntax

utils.setUsername(
username //String
);

Details

ArgumentTypeDescription
usernameStringthe new username to set

setVariable​

Set the value for the specified attribute name, related to the input object.

Syntax

utils.setVariable(
attributeName, //String
value //Object
);

Details

ArgumentTypeDescription
attributeNameStringattribute name contained in the input object
valueObjectvalue to set

sha256​

Computes the SHA-256 hash of the given text.

Syntax

//return String type
var risp = utils.sha256(
text //String
);

Details

ArgumentTypeDescription
textStringthe input string to hash

✅ Returns

the SHA-256 hash as an uppercase hexadecimal string

⚠️ Throws

  • Exception in case of hashing errors

startThreadedAction​

Enqueue a server-side JavaScript action for asynchronous execution in a separate thread. The action is identified by its ID and will be executed after an optional delay.

Syntax

utils.startThreadedAction(
actionId, //Long
waitTime, //Long
args //Map
);

Details

ArgumentTypeDescription
actionIdLongthe platform action ID to execute (must exist in the application's action map)
waitTimeLongmilliseconds to wait before starting the action execution. If greater than 0, the thread sleeps before execution. If less than 0, the action is executed synchronously (in the current thread). If 0 or null, the action starts immediately in a new thread
argsMapa Map<String, Object> of parameters to pass to the action. These become the "vo" (value object) input parameters available inside the target action. Keys are parameter names, values are the corresponding parameter values. The map is shallow-copied before the thread starts, so modifications after this call do not affect the enqueued action @implNote The action is executed via WAGExecuteJsBean.processAction server call in a new thread. The current platform transaction ID is propagated to the spawned action via headers. If waitTime is negative, Thread.run() is called instead of Thread.start(), causing synchronous execution in the current thread.

stringifyForDatabaseField​

Convert a javascript object as a JSON string, containing escape characters for each " symbol, soi that it can be saved in a database field and re-read later in a compatible format for JSON.parse(); Example: stringifyForDatabaseField({ text: "ABC" }) -> "{ "text": "ABC" }"

Syntax

//return String type
var risp = utils.stringifyForDatabaseField(
obj //Object
);

Details

ArgumentTypeDescription
objObjectjavascript object to convert

stringify​

Serializes any Java object to its JSON string representation using Gson. Supports special floating point values and formats dates as "yyyy-MM-dd HH:mm:ss".

Syntax

//return String type
var risp = utils.stringify(
o //Object
);

Details

ArgumentTypeDescription
oObjectthe object to serialize

✅ Returns

the JSON string representation


suspend​

Suspends the execution of the current server-side JavaScript action. The action is put into a suspended state and can be resumed later via resume. This overload uses an empty suspending identifier. @throws Throwable if the action cannot be suspended (e.g. business components cannot be suspended) @see #suspend(String)

Syntax

utils.suspend();

⚠️ Throws

  • Throwable if the action cannot be suspended (e.g. business components cannot be suspended)

suspend​

Suspends the execution of the current server-side JavaScript action. The action is put into a suspended state and can be resumed later via resume. This overload uses an empty suspending identifier. @throws Throwable if the action cannot be suspended (e.g. business components cannot be suspended) @see #suspend(String)

Syntax

utils.suspend(
suspendingId //String
);

Details

ArgumentTypeDescription
suspendingIdStringan identifier for this suspension, useful for tracking multiple suspended actions

⚠️ Throws

  • Throwable if the action cannot be suspended (e.g. business components cannot be suspended)

terminateElaborationState​

Set the final state for the linked monitored service. Optionally, append a message.

Syntax

utils.terminateElaborationState(
elaborationState, //String
result, //String
logType, //String
logMessage, //String
messageCode //String
);

Details

ArgumentTypeDescription
elaborationStateStringfinal monitored-service state to persist, for example OK or KO.
resultStringresult text/details to store together with the final elaboration state.
logTypeStringoptional log type to append after closing the elaboration, for example INFO, WARN, or ERROR.
logMessageStringoptional log message to append after closing the elaboration.
messageCodeStringoptional message code associated with the appended elaboration log entry.

textToInt​

Parses a string to a Long integer value, trimming leading and trailing whitespace.

Syntax

//return Long type
var risp = utils.textToInt(
text //String
);

Details

ArgumentTypeDescription
textStringthe string to parse; may be null or blank

✅ Returns

the parsed Long value, or null if the input is null or blank

⚠️ Throws

  • Throwable if the text cannot be parsed as a valid integer (NumberFormatException)

trim​

Trim method used by Javascript actions

Syntax

//return String type
var risp = utils.trim(
text //String
);

Details

ArgumentTypeDescription
textStringtext value to trim; if null, null is returned.

uncamel​

Convert an attribute name to a database field name representation. Example: fieldName -> FIELD_NAME

Syntax

//return String type
var risp = utils.uncamel(
attributeName //String
);

Details

ArgumentTypeDescription
attributeNameStringtable.fieldname

✅ Returns

representation of the specified attribute name as a database field name


unzip​

Extracts a ZIP archive to the specified output directory.

Syntax

//return String type
var risp = utils.unzip(
directoryId, //Long
zipFile, //String
directoryIdOut, //Long
deleteZipFile //Boolean
);

Details

ArgumentTypeDescription
directoryIdLongdirectory identifier where the ZIP file is located
zipFileStringname of the ZIP file to extract (relative to the directory)
directoryIdOutLongdirectory identifier where the extracted files will be placed
deleteZipFileBooleanif true, the ZIP file is deleted after extraction

✅ Returns

an error message in case of errors, or an empty string on success

⚠️ Throws

  • Throwable in case of I/O errors

updateApplUserParameter​

Updates one or more application-level user parameters for a specific user. For each parameter, attempts to fetch the existing record; if not found, creates a new one. Only updates description and note fields when they are explicitly present in the Map.

Syntax

//return ListResponse type
var risp = utils.updateApplUserParameter(
companyId, //String
siteId, //Long
userCodeId, //String
parameters //Map[]
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
userCodeIdStringthe user code whose parameters are being updated
parametersMap[]an array of Maps, each representing a parameter to update. Expected keys: (details below)

parameters​

an array of Maps, each representing a parameter to update. Expected keys:

  • "codeId" (String) — the parameter code identifier (required, used for lookup)
  • "value" (String) — the new parameter value (required)
  • "description" (String) — optional; updates description only if key is present
  • "note" (String) — optional; updates note only if key is present

✅ Returns

a ListResponse containing the updated Prm40ApplUserPar records, or null if an error occurs

⚠️ Throws

  • Throwable if a server communication error occurs

updateDbTableMetadata​

Updates the metadata cache for the specified database table. Forces a refresh of the table's structural metadata (columns, types, constraints) in the platform.

Syntax

utils.updateDbTableMetadata(
dbTableId //Long
);

Details

ArgumentTypeDescription
dbTableIdLongthe database table identifier whose metadata should be refreshed

⚠️ Throws

  • Throwable if a server communication or database error occurs

updateMappedObject​

Execute an UPDATE SQL statement into the specified table, starting from the javascript NEUTRAL object passed as argument, containing many more attributes, not all related to such a table. The right attributes to take into account from the neutral object will be selected using the mapping defined to the specified data model and table name. All object attributes will be converted to database fields (uncamel format); example: productCode -> PRODUCT_CODE It is possible to force a '' value to null It is possible to force all not specified attributes to null A pks set is also needed in order to generate the right WHERE clause

Syntax

//return boolean type
var risp = utils.updateMappedObject(
neutralObject, //Map
emptyAsNull, //Boolean
forceAttributesToNull, //Boolean
dataModelId, //Long
additionalAttributes, //Map
separatedTransaction, //Boolean
interruptExecution, //Boolean
pks //String[]
);

Details

ArgumentTypeDescription
neutralObjectMapjavascript object to insert into the specified table
emptyAsNullBooleantrue to convert empty-string values extracted from neutralObject into SQL NULL values.
forceAttributesToNullBooleantrue to force writable attributes not present in neutralObject/additionalAttributes to NULL during the update.
dataModelIdLongdata model id, which MUST have MAPPER type, containing the mapping needed to extract the right attributes
additionalAttributesMapcan be null; if specified, contains additional to include the object under construction, used to generate the SQL instruction
separatedTransactionBooleanflag used to define if this query has to be performed in a separated transaction
interruptExecutionBooleanflag used to defined if the whole server side transaction must be interrupted and rollbacked in case of errors
pksString[]attribute names, expressed in camelCase, that compose the primary key/WHERE clause used to identify the record to update.

✅ Returns

true if the record has been successfully updated

⚠️ Throws

  • Throwable in case of errors

updateMappedObject​

Execute an UPDATE SQL statement into the specified table, starting from the javascript NEUTRAL object passed as argument, containing many more attributes, not all related to such a table. The right attributes to take into account from the neutral object will be selected using the mapping defined to the specified data model and table name. All object attributes will be converted to database fields (uncamel format); example: productCode -> PRODUCT_CODE It is possible to force a '' value to null It is possible to force all not specified attributes to null A pks set is also needed in order to generate the right WHERE clause

Syntax

//return boolean type
var risp = utils.updateMappedObject(
neutralObject, //Map
emptyAsNull, //Boolean
forceAttributesToNull, //Boolean
tableName, //String
dataModelId, //Long
additionalAttributes, //Map
separatedTransaction, //Boolean
interruptExecution, //Boolean
pks //String[]
);

Details

ArgumentTypeDescription
neutralObjectMapjavascript object to insert into the specified table
emptyAsNullBooleantrue to convert empty-string values extracted from neutralObject into SQL NULL values.
forceAttributesToNullBooleantrue to force writable attributes not present in neutralObject/additionalAttributes to NULL during the update.
tableNameStringtable name which must be defined as a writable object
dataModelIdLongdata model id, which MUST have MAPPER type, containing the mapping needed to extract the right attributes
additionalAttributesMapcan be null; if specified, contains additional to include the object under construction, used to generate the SQL instruction
separatedTransactionBooleanflag used to define if this query has to be performed in a separated transaction
interruptExecutionBooleanflag used to defined if the whole server side transaction must be interrupted and rollbacked in case of errors
pksString[]attribute names, expressed in camelCase, that compose the primary key/WHERE clause used to identify the record to update.

✅ Returns

true if the record has been successfully updated

⚠️ Throws

  • Throwable in case of errors

updateObject​

Execute an UPDATE SQL statement into the specified table, starting from the javascript object passed as argument. All object attributes will be converted to database fields (uncamel format); example: productCode -> PRODUCT_CODE It is possible to force a '' value to null It is possible to force all not specified attributes to null

Syntax

//return boolean type
var risp = utils.updateObject(
obj, //Map
emptyAsNull, //Boolean
forceAttributesToNull, //Boolean
tableName, //String
dataSourceId, //Long
separatedTransaction, //Boolean
interruptExecution //Boolean
);

Details

ArgumentTypeDescription
objMapjavascript object to update into the specified table
emptyAsNullBooleanflag used to force an empty '' attribute value to a null value
forceAttributesToNullBooleanflag uded to force all not specified attributes to null
tableNameStringtable name which must be defined as a writable object (iut must have a data mode)
dataSourceIdLongoptional data source id
separatedTransactionBooleanflag used to define if this query has to be perfomed in a separated transaction
interruptExecutionBooleanflag used to defined if the whole server side transation must be interruped and rollbacked in case of errors

✅ Returns

true if the record has been successfully updated

⚠️ Throws

  • Throwable in case of errors

updatePeopleData​

Updates the personal data (people record) associated with an existing user. Retrieves the user, finds the associated Sub01People record via the subject ID, and applies attribute updates from the provided Map.

Syntax

//return Sub01People type
var risp = utils.updatePeopleData(
companyId, //String
siteId, //Long
userCodeId, //String
data //Map
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
userCodeIdStringthe user code identifier (will be converted to uppercase)
dataMapa Map of people attributes to update; keys are attribute names (e.g. "name", "surname", "address", "city") that map to setter methods of Sub01People via reflection

✅ Returns

the updated Sub01People object, or null on error

⚠️ Throws

  • Throwable in case of errors

updateUserRole​

Updates roles for an existing user. This is an alias for Long, String, Map[]).

Syntax

//return Prm01User type
var risp = utils.updateUserRole(
companyId, //String
siteId, //Long
userCodeId, //String
roles //Map[]
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
userCodeIdStringthe user code identifier (will be converted to uppercase)
rolesMap[]an array of Maps defining the complete set of roles; see addUserRole for Map structure

✅ Returns

the Prm01User object if roles were updated successfully, or null on error

⚠️ Throws

  • Throwable in case of errors

updateUser​

Updates an existing user's language and additional attributes. Retrieves the user by primary key, updates the language passport record if changed, and applies any additional attribute values from the provided Map.

Syntax

//return Prm01User type
var risp = utils.updateUser(
companyId, //String
siteId, //Long
userCodeId, //String
languageId, //String
user //Map
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
userCodeIdStringthe user code identifier (will be converted to uppercase)
languageIdStringthe new language ID to set; if empty or unchanged, no language update occurs
userMap(optional) a Map of user attributes to update; keys are attribute names (e.g. "email", "firstName", "lastName") that map to setter methods of Prm01User via reflection

✅ Returns

the updated Prm01User object, or null on error

⚠️ Throws

  • Throwable in case of errors

userRoleActive​

Checks whether a specific role is currently active for a user on the given date.

Syntax

//return boolean type
var risp = utils.userRoleActive(
companyId, //String
siteId, //Long
userCodeId, //String
roleId, //String
activeDate //Date
);

Details

ArgumentTypeDescription
companyIdStringthe company identifier
siteIdLongthe site identifier
userCodeIdStringthe user code identifier
roleIdStringthe role identifier to check
activeDateDatethe date on which to verify role activity

✅ Returns

true if the role is active for the user on the given date, false otherwise

⚠️ Throws

  • Throwable in case of errors

validateCode​

Validates (decodes) a field value from a source (border) table by looking it up in a reference table, and writes the found foreign key back into the source table. Used in ETL pipelines to resolve code values (e.g., item codes, VAT codes) against master data tables. The method automatically selects the optimal validation strategy based on the number of distinct values to validate: Fewer than 1000 distinct codes: uses multiple individual UPDATE statements 1000+ distinct codes: uses a single UPDATE with JOIN (MySQL) or subquery (generic) When validation fails (code not found in reference table), error information is written back to the source table's error fields.

Syntax

utils.validateCode(
settings //Map
);

Details

ArgumentTypeDescription
settingsMapa Map containing the following expected keys: (details below)

settings​

a Map containing the following expected keys:

  • srcDatasourceId (Number, optional): data source id for the source table connection
  • destDatasourceId (Number, optional): data source id for the reference (lookup) table connection
  • fromTable (String, required): name of the source (border) table containing codes to validate
  • fromTableFilter (String, optional): SQL WHERE clause to filter source records
  • fromRowId (String, optional): row identifier field in the source table (used in JOIN-based updates)
  • fromFieldCode (String, required): comma-separated field name(s) in the source table containing the code value(s) to decode
  • fromFK (String, required): foreign key field in the source table where the resolved key will be written
  • toTable (String, required): name of the reference (master) table to look up codes
  • toTableFilter (String, optional): SQL WHERE clause to filter reference table records
  • toFieldCode (String, required): comma-separated field name(s) in the reference table to match against fromFieldCode
  • toFK (String, required): primary key field in the reference table to retrieve as the resolved value
  • errorFieldName (String, optional): field name in source table to store error details (JSON array)
  • containsErrorsField (String, optional): field name in source table for error flag ("Y"/"N")
  • commitSize (Number, optional, default 1000): number of rows per batch commit
  • forceOneUpdate (Boolean, optional): if true, forces the single-UPDATE strategy regardless of row count
  • useJoin (Boolean, optional): if true and on MySQL, uses JOIN syntax for the single-UPDATE strategy; otherwise uses a correlated subquery

⚠️ Throws

  • Throwable if a database error occurs or required settings are missing

waitAllElements​

Wait for termination of all elements enqueued and identified by the specified element ids. After that, execute the specified actionId in the specified queue.

Syntax

utils.waitAllElements(
queueName, //String
actionId, //Long
elementIds //Long[]
);

Details

ArgumentTypeDescription
queueNameStringname of the queue that must receive the follow-up action once all elements have completed.
actionIdLongserver-side action identifier to enqueue after all specified elements have terminated.
elementIdsLong[]queue element identifiers to wait for before triggering actionId.

waitAnyElement​

Wait for termination of at least one of the elements enqueued and identified by the specified element ids. After that, execute the specified actionId in the specified queue.

Syntax

utils.waitAnyElement(
queueName, //String
actionId, //Long
elementIds //Long[]
);

Details

ArgumentTypeDescription
queueNameStringname of the queue that must receive the follow-up action once any specified element has completed.
actionIdLongserver-side action identifier to enqueue after the first specified element has terminated.
elementIdsLong[]queue element identifiers to monitor.

warn​

Logs a message at WARN level. Shorthand for log(msg, "WARN").

Syntax

utils.warn(
msg //String
);

Details

ArgumentTypeDescription
msgStringthe log message text @see #log(String, String)

writeBase64File​

Write to the local file system the file content passed as argument.

Syntax

utils.writeBase64File(
filePath, //String
base64Content //String
);

Details

ArgumentTypeDescription
filePathStringpath + file name to create
base64ContentStringfile content, expressed in BASE 64.

writeToCSVFile​

Add a row to an already opened CSV file.

Syntax

utils.writeToCSVFile(
uuid, //String
obj, //Map
rowSeparator //String
);

Details

ArgumentTypeDescription
uuidStringoutput stream identifier, related to a CSV file already opended; this id is returned by the "openCSVFile" method
objMapa record, containing data to save into the row to write
rowSeparatorStringoptional custom row separator string appended after each row; if null, the system default line separator is used

⚠️ Throws

  • Throwable in case the CSV file has not been opened

writeToCSVFile​

Add a row to an already opened CSV file.

Syntax

utils.writeToCSVFile(
uuid, //String
obj //Map
);

Details

ArgumentTypeDescription
uuidStringoutput stream identifier, related to a CSV file already opended; this id is returned by the "openCSVFile" method
objMapa record, containing data to save into the row to write

⚠️ Throws

  • Throwable in case the CSV file has not been opened

writeToTextFile​

Add a row to an already opened text file. NO additional CR characters are automatically added to the row: it is up to the programmer to add them, if needed.

Syntax

utils.writeToTextFile(
uuid, //String
text //String
);

Details

ArgumentTypeDescription
uuidStringoutput stream identifier, related to a CSV file already opended; this id is returned by the "openCSVFile" method
textStringtext to append to the already opened file; line separators are not added automatically.

⚠️ Throws

  • Throwable in case the text file has not been opened

zipFiles​

Create a zip file containing the list of passed files.

Syntax

//return boolean type
var risp = utils.zipFiles(
baseDirId, //Long
zipFile, //String
deleteFilesAfterZip //Boolean
);

Details

ArgumentTypeDescription
baseDirIdLongdirectory identifier whose content must be zipped recursively.
zipFileStringzip file to create, including the absolute path
deleteFilesAfterZipBooleanflag used to decide if deleting all input files after the zip creation

✅ Returns

true if the zip file has been created successfully, false otherwise


zipFiles​

Create a zip file containing the list of passed files.

Syntax

//return boolean type
var risp = utils.zipFiles(
baseDir, //String
files, //String[]
zipFile, //String
deleteFilesAfterZip //Boolean
);

Details

ArgumentTypeDescription
baseDirStringbase dir used to calculate the entry in the zip (i.e. a relative path + file name)
filesString[]files to zip (each including an absolute path)
zipFileStringzip file to create, including the absolute path
deleteFilesAfterZipBooleanflag used to decide if deleting all input files after the zip creation

✅ Returns

true if the zip file has been created successfully, false otherwise