Helper Classes
Helper classes consist of methods that greatly reduce the needed effort and the amount of required code to perform a specific operation, so it’s recommended to use them as much as possible. These classes are also context aware, meaning that the classes are able to determine some base parameters on their own, such as the current module, record and namespace.
Example of creating a new record with the help of Compose
helper class (note how we don’t need to specify the namespace):
Compose.makeRecord({ Title: 'Lead title' }, 'Lead')
.then(myLead => Compose.saveRecord(myLead))
.then(mySavedLead => {
mySavedLead.recordID // saved recordID
})
All helper classes are available in the automation script’s execution context:
ctx.Compose
-
Provides functions to work with Corteza Low Code, such as accessing, creating and deleting records. See the definition for details,
ctx.ComposeUI
-
Provides functions to work with user interface for Corteza Low Code, such as opening record pages and showing notifications. See the definition for details,
ctx.Messaging
-
Provides functions to work with Corteza Messaging, such as creating channels and creating messages. See the definition for details,
ctx.System
-
Provides functions to work with Corteza core system, such as finding and creating users and managing role membership. See the definition for details.