Type parameters
Hierarchy
- Application
Properties
Readonly cache
Cache for temporary data storage (isolated in the app).
Readonly fields
Description of app fields.
Readonly name
App name.
Readonly processes
Processes in the app.
Learn about other features in Processes.
Readonly serial
Counter in the app.
Readonly storage
Long-term storage used to store any string data on the server (isolated in an app).
Methods
create
-
The method allows creating a new app item.
After you initiate app item creation and fill out the item's fields, you need to save it using the [[ApplicationItem.save]] method.
const item = Application.create(); item.data.__name = Context.data. request_subject; await item.save();
Returns ApplicationItem<T, P>
createFolder
-
The method creates a new folder in the app (on the first nesting level).
In this example, we use the method to create a new folder in an app.
const folder = await Application.createFolder('name');
Parameters
-
name: string
Name of the new folder.
Returns Promise<TFolder>
-
getFolders
-
The method returns an array of app folders (on the first nesting level).
In this example, we use the method to get all folders in the app.
const folders = await Application.getFolders();
Returns Promise<TFolder[]>
Folders set up in an app.
getPermissions
-
The method retrieves access permissions set for the app item.
Learn more about how the method works in [[ApplicationItem.getPermissions]].
Returns Promise<TPermissionsSettings>
getSettings
-
Returns settings set for the app.
const settings = await Application.getSettings(); // Whether registration is enabled const on_registry = settings.registrationSettings.enabled // List of IDs of folders available for this app const nomIDs = settings.registrationSettings.nomenclatureIds // Returns a list of folders available for the app const nomenclatures = settings.registrationSettings.getNomenclatures();
Returns Promise<TSettings>
hasPermission
-
The method checks permissions of a user, group, org chart item, or role.
Parameters
-
orgunit: TPermissionOrgunit
User, group, org chart item, or role that has the permissions.
-
type: PermissionType
Access level. Read more about this method in [[ApplicationItem. hasPermission]].
Returns Promise<boolean>
-
search
-
The method can be used to search for an app item.
Learn more about searching for app items in the Manage apps article.
Returns ApplicationSearch<T, P>
setPermissions
-
The method sets new access permissions for an app item.
Learn more about how the method works in [[ApplicationItem.setPermissions]].
Parameters
-
permissions: TPermissions
Returns Promise<void>
-
statusHistory
-
The method is used to search in an app item’s status change history.
The method returns the StatusHistorySearch object that supports filtration and sorting of search results.
// Let’s history of assigning the `done` status // over the last day const today = new Datetime(); const yesterday = today.addDate(0, 0, -1); const changes = Application.statusHistory() .where((f, g) => g.and( f. __createdAt.gte(yesterday), f.target.eq(Application.fields.__status. variants.done.id), )) .all(); // Let’s get full data for all items // whose status changes to `done` const items = await Promise. all(changes.map(change => change.data.item!.fetch()));
Returns StatusHistorySearch<T, P>
App object
App object can be accessed in business processes and widgets associated with apps. The Application object provides methods and data to work with the current app.