Library of System Functions for Custom Scripts
When you're creating your custom scripts, you can use a feature that enables you to use System Functions that auto-populate APIs into your script. Type Control + Space, scroll down to the System Functions section, and you'll see a list of APIs that you can use. Here are more details about the System Functions and their related classes.
System Functions
These are the System Functions that are available:
Method Signature |
Definition |
Usage |
---|---|---|
|
Returns the current row. For information about the Row class methods, refer to the table below. |
|
|
Returns the current child row if we are in context of a child row, else it returns null. Refer to the Row class methods in the next table. |
|
|
Creates new row or child row for the given resource
and child type. Only supported in Refer to the Row class methods in the next table. |
Note: The use of this API is recommended for creating a row for the top
level resource only. For creating a child of a top level resource, please
refer to
addNewChildRow under Row class. |
|
Returns Query object for the given resource. This can be used to query rows of the given resource by setting query parameters. This function only queries for data stored locally on the device. Refer to the Query class methods in the next table. |
Note: This API is for querying on the basis of primary key only. To query
using any other field please refer to the
queryWithParameters API below. |
|
Returns For information about the |
|
|
Returns Refer to the |
|
|
Returns an instance of Refer to the |
|
|
Returns the parent object from which the current object was accessed. Only to be used in context of top level objects being visited via another top level object. Note: This function doesn't return the parent for a child
row.
Refer to the Row class methods in the next table. |
|
|
Returns local list of values |
|
|
Used to query for records by passing dynamic fields, operator, and values. |
|
Class Methods
Here are the class methods for the System Functions outlined in the previous table and examples of how you can use them.
-
Row Class Methods:
Method Signature |
Definition |
Usage |
---|---|---|
|
Used to set value of a particular column of the row. |
|
|
Used to get value of a particular column of the row. |
|
|
Returns true if the row is new else it returns false. |
|
|
Returns the resource to which the row belongs. |
|
|
Used to set value of mandatory property for a particular column. Note: Use this function instead of the CX Cloud Mobile function if you're
copying your CX Cloud Mobile script.
|
|
|
Used to set value of updatable property for a particular column. |
|
|
Used to display/hide a particular column. |
|
|
Adds new child to the row. |
|
|
Used to change the display type of a field to text, scan or number. |
|
|
Used to disable or enable the save action in the edit view. |
|
|
Used to get the original values of a field before it was modified. |
|
-
Query Class Methods:
Method Signature |
Definition |
Usage |
---|---|---|
|
Used to get all available parameters for this query. |
|
|
Used to set value of a particular query parameter. |
|
|
Used to perform the query. It returns the set of rows that satisfy the query criteria. |
|
-
UserPreferences Class Methods:
Method Signature |
Definition |
Usage |
---|---|---|
|
Returns user settings. |
|
|
Returns the user name for the current user. |
|
|
Returns name of the current user. |
|
|
Returns date format set by the current user. |
|
|
Returns ID of the current user. |
|
|
Returns currency set by the current user. |
|
|
Returns time zone set by the current user. |
|
|
Returns number format set by the current user. |
|
|
Returns language set by the current user. |
|
|
Returns roles assigned to the current user. |
|
|
Returns all the profile options for the current user. |
|
|
Returns profile option value of the specified profile option for the current user if the profile option exists, else it returns null. |
|
|
Returns true if the specified role is assigned to the current user else it returns false. |
|
|
Used to fetch the default BU of the current user. Refer to the Business Unit Class Method below. |
|
-
DeviceInfo
Class Methods:
Method Signature |
Definition |
Usage |
---|---|---|
|
Returns the location of the device. Parameters:
|
|
|
Returns the operating system name for the device. |
|
|
Returns platform name of the device. |
|
|
Returns device version. |
|
|
Returns device model name. |
|
|
Returns true if the device is online, else false. |
|
-
CXCoreLogger
Class Methods:
Method Signature |
Definition |
Usage |
---|---|---|
|
Set logging level. Level values can be : info, error, warn, log, and none. |
|
|
Logs the message at log level. |
|
|
Logs the message at info level. |
|
|
Logs the message at warn level. |
|
|
Logs the message at error level. |
|
-
Result Class Methods:
Method Signature |
Definition |
Usage |
---|---|---|
|
Used to include a newly created row, or updated row, in the set of rows that the script has modified. This action will ensure that the included row is committed by event-handler implementation. |
Note: Any row created or modified in an After Save event needs to be added
using the Result object's
setModifiedObject API, so that
the changes are saved. |
|
Used to add a message that can be returned to the
event handler implementation. The key can be : |
|
|
Used to set the error message and to mark the outcome
qualifier as |
|
|
Used to set qualifier to be handled post script execution.
Returned string could be either |
|
-
Business Unit Class Methods:
Method Signature |
Definition |
Usage |
---|---|---|
|
Used to get name of the Business Unit. |
|
|
Used to get BusinessUnitID. |
|
|
Used to get the Business Unit name. |
|
|
Used to get BU ID. |
|
|
Used to get default |
|