Contains a set of fields and methods common to reference objects of any app item.
Reference objects are generally used in App
type properties to avoid loading all related data at once.
The method allows you to permanently delete an app item.
The operation is available only for a soft-deleted item (with __deletedAt !== null).
If you attempt to delete an active item, the method returns an error:
fail to hard deleteitems: cannot hard deleteitemwith id \"019db3d5-6e26-7128-bde8-f0bd222018ba\" reason: __deletedAt === null.
If the hard delete feature is disabled in your company, the method returns an error: method not available.
const app = Context.data.applicationItem;
if (!app) {
return;
}
const appFetch = await app.fetch();
if (appFetch.data.__deletedAt) {
await app.hardDelete();
}
Base reference object for an app item
Contains a set of fields and methods common to reference objects of any app item. Reference objects are generally used in App type properties to avoid loading all related data at once.
Type parameters
Data: ItemData
Params: ItemData
_Processes: Processes
I: Item<ItemData>
Hierarchy
Properties
Readonly code
App code of the URL’s target (the app’s code).
Readonly id
ID of the URL’s target.
Readonly namespace
Link target namespace (the code of the app's workspace).
Methods
delete
The method allows you to soft-delete an app item.
await Context.data.app.delete();Returns Promise<void>
docflow
This method returns an object to work with document management operations.
const item = await Context.data.n1; const approvalLists = await item.docflow().getApprovalLists();Returns DocflowApplicationItemRef
fetch
Request complete data of a reference object.
Returns Promise<BaseApplicationItem<Data, Params>>
getFolder
The method returns the folder from the folder tree that an item is in.
const item = await Context.data.n1; const folder = await item. getFolder();Returns Promise<TFolder | undefined>
getRegistrations
Deprecated
Deprecated. Get a list of registrations of an app item.
const item = Context.data.d1! await item.getRegistrations();The method is deprecated. Use docflow:
const item = Context.data.d1! await item.docflow().getRegistrations();Returns Promise<ApplicationItemRegistration[]>
getSettings
The method returns an app’s settings.
const app = Context.data.dokument; if (app === undefined) { return; } const settings = await app.getSettings();Returns Promise<TSettings>
hardDelete
The method allows you to permanently delete an app item.
The operation is available only for a soft-deleted item (with __deletedAt !== null). If you attempt to delete an active item, the method returns an error:
fail to hard delete items: cannot hard delete item with id \"019db3d5-6e26-7128-bde8-f0bd222018ba\" reason: __deletedAt === null.If the hard delete feature is disabled in your company, the method returns an error: method not available.
const app = Context.data.applicationItem; if (!app) { return; } const appFetch = await app.fetch(); if (appFetch.data.__deletedAt) { await app.hardDelete(); }Returns Promise<void>
manualRegister
Deprecated
Deprecated. Manual registration of an app item (if manual registration is enabled in the folder’s settings).
The method is deprecated. Use docflow:
const item = Context.data.d1! const settings = await Application.getSettings(); settings .registrationSettings.nomenclatureIds.forEach(nomenclatureId => { item. docflow().manualRegister('Number 1', nomenclatureId); })Parameters
nameReg: string
nomenclatureId: string
Returns Promise<boolean>
register Deprecated
Method is deprecated. Automatic app item registration.
The method is deprecated. Use docflow:
const item = Context.data.d1! const settings = await Application.getSettings(); settings .registrationSettings.nomenclatureIds.forEach(nomenclatureId => { item. docflow().register(nomenclatureId); })Parameters
nomenclatureId: string
Returns Promise<boolean>
restore
This method allows you to restore a soft-deleted app item.
await Context.data.app.restore();Returns Promise<void>
sendMessage
The method allows sending messages to an app item’s activity stream.
Parameters
title: string
message: string
Returns Promise<void>
setFolder
The allows you to change the app item’s folder in the Folder hierarchy.
Parameters
id: string
Returns Promise<void>
Feedback sent successfully
Thank you for your input