- Home [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
- Getting started
- Manage types
- Global context and isolation
- Manage apps
- Work with external services
- Scripts in widgets
- Web components
- Access permissions
- Getting started with processes
- Getting started with signatures
- Getting started with file previews
- Getting started with the organizational chart
- Getting started with users and groups
-
Getting started with the
Table data type - Use cases
- How to set up custom view of app items
- How to set up dynamic display of fields and widgets with a complex condition
- How to register a document
- How to calculate the number of days between two dates
- How to create a substitution for a user
- How to use pagination and sorting when searching for app items
- Document flow
In this article
Document flow
You can work with document categorization (folders), registration, and reservation of registration numbers, as well as with approval sheets and lists of informed users, using methods of the DocflowApplicationItemRef type.
Working with approval sheets and lists of informed users
You can get approval sheets and lists of informed users using the DocflowApplicationItemRef.getApprovalLists and
DocflowApplicationItemRef.getInformLists methods. For instance, you can get approval sheets as follows:
const item = await Context. data.n1; const approvalLists = await item.docflow().getApprovalLists();
You can continue working with these lists, for example, get statuses,
lists of approvers or informed users, creation or editing dates
for (const list of approvalLists) { const {status, respondents, createdAt: __createdAt} = list; }
Approval sheets and lists of informed users are represented by the BaseList type.
Working with document categorization (folders)
You can get a specific folder using the DocflowApplicationItemRef.getNomenclature method. To get the folder data, you need to pass the folder’s ID. You can get it either from the app’s Registration Settings
const settings = await Application.getSettings(); settings.registrationSettings.nomenclatureIds. forEach(nomenclatureId => { ... });
or from the list of registrations of the app item
const item = Context.data.d1! const registrations = item.docflow().getRegistrations(); registrations. forEach(registration => { const {nomenclatureId} = registration; ... })
The folders are represented by the TNomenclature type.
Data acquisition and processing may look like this:
const item = Context.data.d1! const settings = await Application.getSettings(); const nomenclatures = []; for (const nomenclatureId of settings. registrationSettings.nomenclatureIds) { const nomenclature = await item. docflow().getNomenclature(nomenclatureId); if (nomenclature !== undefined) { const {id: __id, name: __name} = nomenclature; nomenclatures.push(nomenclature); } }
Registration and reserving registration numbers for apps
Each app can be registered in several folders if it is configured in the app’s settings. To get all registrations of a document, use the [[DocflowApplicationItemRef. getRegistrations]] method. Registrations are of ApplicationItemRegistration type. For example, you can get the IDs of folders an app is registered in as follows:
const item = Context.data.d1! const registrations = await item.docflow(). getRegistrations(); for (const registration of registrations) { const nomenclatureId = registration.nomenclatureId; }
To manage registrations, use the DocflowApplicationItemRef.register and
DocflowApplicationItemRef.deleteReservation methods. These methods expect the ID of the folder that an app item needs to be registered in or for which registration needs to be canceled. Example of registering an app item in all folders specified in the app’s settings:
const item = Context.data.d1! const settings = await Application.getSettings(); settings.registrationSettings.nomenclatureIds.forEach(nomenclatureId => { item.docflow().register(nomenclatureId); })
It is also possible to register an app item manually and specify the registration number.
Manual registration is available if it is enabled in the folder’s settings.
To register an app item manually, use the [[DocflowApplicationItemRef. manualRegister]] method. Eample of manual registration:
const item = Context.data.d1! const settings = await Application. getSettings(); settings.registrationSettings.nomenclatureIds.forEach( nomenclatureId => { item.docflow().manualRegister('Test number 1', nomenclatureId); })
To reserve a registration number, use the DocflowApplicationItemRef.reserve method. This method returns the reserved number. To cancel registration number reservation, use the DocflowApplicationItemRef.deleteReservation method. Both methods expect the folder ID as the perameter. If an error occurs while reserving a number, an error will be generated. Example of reserving a number for a specific folder:
const item = Context.data.d1! const settings = await Application.getSettings(); const nomenclatures = []; for ( const nomenclatureId of settings.registrationSettings.nomenclatureIds) { const nomenclature = await item.docflow(). getNomenclature(nomenclatureId); if (nomenclature !== undefined) { nomenclatures.push(nomenclature); } } const nomenclatureName = 'needed folder name'; const nomenclatureForReservation = nomenclatures. find(nom => nom.name === nomenclatureName); if (nomenclatureForReservation !== undefined) { const reservedNumber = await item.docflow(). reserve(nomenclatureForReservation.__id); }